Magento change the currency selector dropdown to a flag list

To change the currency selector dropdown to a flag list, you can take following these steps:
1. Open file app/design/frontend/default/your_theme/template/directory/currency.phtml (or app/design/frontend/base/default/template/directory/currency.phtml)and change code from:

 <select name="currency" title="<?php echo $this->__('Select Your Currency') ?>" onchange="setLocation(this.value)">
        <?php foreach ($this->getCurrencies() as $_code => $_name): ?>
            <option value="<?php echo $this->getSwitchCurrencyUrl($_code) ?>"<?php if($_code==$this->getCurrentCurrencyCode()): ?> selected="selected"<?php endif; ?>>
                <?php echo $_name ?> - <?php echo $_code ?>
            </option>
        <?php endforeach; ?>
        </select> 

To:

 <ul>
        <?php foreach ($this->getCurrencies() as $_code => $_name): ?>
                <li>
            <a href="<?php echo $this->getSwitchCurrencyUrl($_code) ?>" onclick="setLocation(this.value);">
                    <img src="your_flag" title="<?php echo $_name ?> - <?php echo $_code ?>"/>
        </a>
                </li>
            
        <?php endforeach; ?>
        </ul> 

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.jpg, Euro -> eur.jpg, Hong Kong Dollar -> hkd.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:

 <ul>
        <?php foreach ($this->getCurrencies() as $_code => $_name): ?>
                <li>
            <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>
                </li>
            
        <?php endforeach; ?>
        </ul> 
Source: http://www.magentocommerce.com/boards/26245/viewthread/240341/#t341337

Leave a Reply

Your email address will not be published. Required fields are marked *