0

I am trying to add all country flag in currency change dropdown in magento?

how may i do this in magento 1.4.2 ?

zaid hussian
  • 55
  • 1
  • 4
  • 9
  • 2
    Images in select controls are [problematic](http://stackoverflow.com/q/2226666/471559). This is not a Magento limitation. – clockworkgeek Jul 28 '11 at 12:16

2 Answers2

1

Very good example for flags. It may help others http://www.phptechi.com/magento-show-country-flags-selector-in-header.html

As stated in that post:

Step 1: Make sure multiple language stores are available. Now open flags.phhml file located at app/design/frontend/default/theme/template/page/switch/flags.html If in case it does not exists then create it and replace existing code/ add following code into file.

Note: Please modify href & src in following code.

< ?php if(count($this->getGroups())>1): ?>

< ?php foreach ($this->getGroups() as $_group): ?>
< ?php echo $this->htmlEscape($_group->getName()) ?>
< ?php endforeach; ?> 
< ?php endif; ?>

Step 2: Now add entry into page.xml file and file header block i.e. “html_header”. In case if you want to add flags in footer section then search for footer block and add following line in footer and do little css to align it correctly.

Step 3: Upload flag images into “skin/frontend/currentTheme/images/” directory and make sure the flag file names are having store name is part of flag name. (i.e. Image name is “flagEnglish.gif”, “flagGerman.gif”. So store names are “English”, “German”, etc)

Now clean the magento cache and reload the home page and you are done!!.

Peter O.
  • 32,158
  • 14
  • 82
  • 96
vaibham
  • 11
  • 1
0

Currency selector with flag in magento

  1. You need to prepare a flag list (images).
  2. Upload flag list to root/media/flag directory
  3. Rename flags to currency’s code (EX: US Dollar -> usd-flag.jpg, Euro -> eur-flag.jpg, Hong Kong Dollar -> hkd-flag.jpg...)
  4. In the template file: app/design/frontend/default/your_theme/template/directory/currency.phtml (or app/design/frontend/base/default/template/directory/currency.phtml), change code to:

    <?php foreach ($this->getCurrencies() as $_code => $_name): ?>
           <a href="<?php echo $this->getSwitchCurrencyUrl($_code) ?>" onclick="setLocation(this.value);">
            <img src="<?php echo Mage::getBaseUrl('media').'flag/'.$_code.'.jpg'; ?>" title="<?php echo $_name ?> - <?php echo $_code ?>" alt="<?php echo $_name ?> - <?php echo $_code ?>" width="20" height="20" />
            </a>
    <?php endforeach; ?>
    
Rahul Shinde
  • 1,522
  • 1
  • 15
  • 17