Jump to content
thirty bees forum
  • 0

Update currency selector to show country flags


x97wehner

Question

Anyone figured out a solution to this? I'd like to have a flag show for USD and CAD in my currency selector as many sites do rather than text of USD/CAD or a $ symbol. Either that or a select country feature with flags that aligns the correct currency.

Thanks in advance.

Link to comment
Share on other sites

17 answers to this question

Recommended Posts

  • 0

at the moment i have only country flag with full country text for blocklanguage

if you have only country text (it may differ depending on the template or additional module) module blocklanguages/blocklanguages.tpl

find {$language.name|regex_replace:"/\s.*$/":""}

replace with (example) <span><img alt="{$language.iso_code}" height="11" span="" src="{$img_lang_dir}{$language.id_lang}.jpg" width="16" /> {$language.name|regex_replace:"/\s.*$/":""}</span>

to 0_1538437444801_45228902-c361-435f-88ed-7b770089fcad-image.png

0_1538437565657_f5e91344-992e-40bc-847b-b57fa710f030-image.png

blockcurrency i have no testet - if it is possible

edit: sorry - but maybe it will help anyway

Link to comment
Share on other sites

  • 0

ok - I keep testing

for language block with flag - default theme

modules / blocklanguages / blocklanguages.tpl

changes

<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> {$current_iso|escape:'html':'UTF-8'} <span class="caret"></span> </a>

to <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> <span><img alt="{$language.iso_code}" height="11" span="" src="{$img_lang_dir}{$language.id_lang}.jpg" width="16" />{$current_iso|escape:'html':'UTF-8'}</span> <span class="caret"></span> </a>

and this

<a href="{$lang_rewrite_urls.$indice_lang|escape:'html':'UTF-8'}" title="{$language.name|escape:'html':'UTF-8'}" rel="alternate" hreflang="{$language.iso_code|escape:'html':'UTF-8'}"> <span>{$language.name|regex_replace:"/\s\(.*\)$/":""}</span> </a> to

<a href="{$link->getLanguageLink($language.id_lang)|escape:'html':'UTF-8'}" title="{$language.name|escape:'html':'UTF-8'}" rel="alternate" hreflang="{$language.iso_code|escape:'html':'UTF-8'}"> <span><img alt="{$language.iso_code}" height="11" span="" src="{$img_lang_dir}{$language.id_lang}.jpg" width="16" /> {$language.name|regex_replace:"/\s\(.*\)$/":""}</span> </a>

result

0_1538514500490_e1a2d678-723e-43f2-9284-d4948b9deefa-image.png

i played a little bit with the code for blockcurrency community-theme-default / modules / blockcurrencies / blockcurrencies.tpl

i changed this

{l s='Currency: %s' sprintf=[$current_iso] mod='blockcurrencies'} <span class="caret"></span> to {l s='Currency: %s' sprintf=[$current_iso] mod='blockcurrencies'} <img src="../../img/l/{$f_currency.id_currency}.jpg" alt="" class="currency_flag" /><span class="caret"></span>

and this <a href="javascript:setCurrency({$f_currency.id_currency});" rel="nofollow" title="{$currency_name}"> {$currency_name} </a> to

<a href="javascript:setCurrency({$f_currency.id_currency});" rel="nofollow" title="{$currency_name}"> <img src="../../img/l/{$f_currency.id_currency}.jpg" alt="" class="currency_flag" /> <span class="currency_text">{$f_currency.sign}</span> </a>

result

0_1538515636317_6b5517ba-af8d-46c5-a8f1-3403d41a835a-image.png

if you do not want the text (iso code) etc, delete the snippets or comment out. i have not tried these changes with countries and same currency etc. application at your own risk.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...