Jump to content

Flags for currencies 5.2.8


Ben224

Recommended Posts

Hello fellow cubecarters,

 

Working with crosshatch 5.2.8. I really need to modify the standard 'select currency' menu to display flag graphics. For example please consider the following menu:

 

(FlagGraphic) $ USD

        (FlagGraphic) $ CAD

         (FlagGraphic) £ GBP

          (FlagGraphic) € EUR

 

There are a few old useful posts out there relating to the subject but I cant quite get it to work. Would appreciate a fresh, up to date approach if anyone can offer one?

 

Many thanks in advance.

Link to comment
Share on other sites

Here is something for the language selector, box.language.php:

Was:
<option value="{$language.code}" {$language.selected}>{$language.title}</option>
Now:
<option value="{$language.code}" {$language.selected} style='background-image:url({$STORE_URL}/language/flags/{$language.code}.png); background-repeat:no-repeat; padding-left:30px;'>{$language.title}</option>

The problem with currencies is that CubeCart does not have flag filenames that include the ISO of the country, such USA.png, CAD.png, JPY.png, ZAR.png. You would need to copy the respective country flag image file to a new filename of the format ISO.png.

 

Then you can apply the same technique as above. For {$language.code}, it would be {$currency.code}.

 

Also, this might mess up your layout. So watch for that.

Link to comment
Share on other sites

Fabulous that works fine. Just one issue, the set currency does not show it's FlagGraphic. In other words:

 

(FlagGraphic) $ USD - Flag not shown

        (FlagGraphic) $ CAD - Flag shown

         (FlagGraphic) £ GBP - Flag shown

          (FlagGraphic) € EUR - Flag shown

 

Here is the modified block of code:

 

<div class="select">
            <select name="set_currency" class="auto_submit">
                 {foreach from=$CURRENCIES item=currency}
                <option value="{$currency.code}" {$currency.selected} style='background-image:url({$STORE_URL}/language/flags/{$currency.code}.png); background-repeat:no-repeat; padding-left:30px;' title="{$currency.name}">{$currency.symbol_left} {$currency.code} {$currency.symbol_right}</option>
                 {/foreach}
            </select>

 

Many thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...