In magento sometimes our client want to show multiple currency options on header. Recently I have experienced it and solve it. Now you can easily do this following the below step:
First step:
First you need to set up multiple currencies options on magento. If you don’t know, please click here
Second step:
After setting up the multiple currency options you need to create a .phtml file named “header-currency.phtml” and paste the below code on it :
<div id="currency-change"> <?php if($this->getCurrencyCount()>1): ?> <strong><span><?php echo $this->__('Select Your Currency') ?></span></strong> <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> <?php endif; ?> </div>
And after saving locate the file to the following location:
app/design/frontend/your-instance-name/your-theme-name/template/directory/header-currency.phtml
If you didn’t find the file on that location you can find it on this following location:
app/design/frontend/base/default/template/directory/header-currency.phtml
Third step:
Now edit your “page.xml” file which is located in
app/design/frontend/your-instance-name/your-theme-name/layout/page.xml
If you didn’t find the file on that location you can find it on this following location:
app/design/frontend/base/default/layout/page.xml
Then paste the following code:
<block type="directory/currency" name="store_currency_selector" as="store_currency_selector" template="directory/header-currency.phtml"/>
After the following code:
<block type="page/html_header" name="header" as="header"> <block type="page/template_links" name="top.links" as="topLinks"/> <block type="page/switch" name="store_language" as="store_language" template="page/switch/languages.phtml"/>
Fourth step:
Now you need to edit “header.phtml” file which is located at:
app/design/frontend/your-instance-name/your-theme-name/template/page/html/header.phtml
If you didn’t find the file on that location you can find it on this following location:
app/design/frontend/base/default/template/page/html/header.phtml
Then add the following code where you want show the multiple currencies options on magento header.
<?php echo $this->getChildHtml('store_currency_selector') ?>
Now check your site header, the multiple currency options on header is showing. Then apply CSS and give the look as you want.