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:
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>
Thats very good post.My probelem Solved.
ReplyDeletetry a premium extension by FMEextensions which adds a popup in the footer and you can select the Currency and Language http://www.fmeextensions.com/magento-geo-ip-default-language-currency.html
ReplyDeleteFor many stores will be better to set auto currency switcher. Here is one https://www.magestyapps.com/magento-extensions/geoip-store-switcher.html
ReplyDeleteThanks Ali,
ReplyDeleteIts really very helpful.
thanks once agian.
Hi,
ReplyDeleteThanks for sharing this code working fine on my website with flag symbol https://www.pacetech.com/
Regards
I do agree with all the ideas you have presented in your post. They’re really convincing and will certainly work. Still, the posts are very short for newbies. Could you please extend them a little from next time?..Keep this great work
ReplyDeletemagento development company in bangalore
thanks for your help ...but i am not able to display USA flag .............
ReplyDeleteIS THIS CODE WORKING IN MAGENTO 2.1.9?
ReplyDelete