voodish logo
tweet rss book of faces Linked In

Currency drop down selector in header, Magento

magento under construction

How to display your currency selector drop down menu in the header of your Magento template. As we know by using the default template, Magento can display the selector in the sidebar, but here’s how to include it in the header, most useful. They can also work together.

Step 1: Create a new phtml file and directory

You will need to create a new directory, named “directory” and create a new file called “currency-top.phtml“:

/app/design/frontend/template/default/YOUR-TEMPLATE-NAME/template/directory/currency-top.phtml and write the following code in it :-

<?php if($this->getCurrencyCount()>1): ?>
<div class="box language-switcher" style="margin-left:15px">
<label for="select-language">Your Currency: </label>
<select name="currency" onchange="changeCurrency(this)">
<?php foreach ($this->getCurrencies() as $_code => $_name): ?>
<option value="<?php echo $_code ?>"<?php if($_code==$this->getCurrentCurrencyCode()): ?> selected="selected"<?php endif; ?>>
<?php echo $_name ?> - <?php echo $_code ?>
<?php endforeach; ?>
<script type="text/javascript">
function changeCurrency(sObject){
setLocation('<?php echo $this->helper('directory/url')->getSwitchCurrencyUrl() ?>currency/'+sObject.value);
<?php endif; ?>

Step 2: Add curency code to page.xml


Add currency_top block after store_language block inside header block of page.xml present around line #66 :-

<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"/>
<block type="directory/currency" name="currency_top" template="directory/currency-top.phtml"/>
<block type="core/text_list" name="top.menu" as="topMenu"/>

Step 3: Add call to header file

Add getChildHtml(‘currency_top’) below getChildHtml(’store_language’) in

/app/design/frontend/template/default/YOUR-TEMPLATE-NAME/template/page/html/header.phtml like below :-

<?php echo $this->getChildHtml('store_language') ?>
<?php echo $this->getChildHtml('currency_top') ?>

Live example


Related Articles

Comments RSS Feed


  1. gsdfind August 23, 2011

    Great!! that’s what i need

  2. Go to Top of the page

  3. ed209 October 5, 2011

    ace, thanks for the write up

  4. Go to Top of the page

  5. SM October 27, 2011

    Just the info I was looking for, thanks!

  6. Go to Top of the page

  7. Shen Pedro March 8, 2012

    Good job! Please, do you know hot to align the dropdown selector on the right?

  8. Go to Top of the page

  9. rajan April 16, 2012

    did not show currency option in frontend in magento.

  10. Go to Top of the page

  11. BuBu June 15, 2012


  12. Go to Top of the page

  13. Turko October 4, 2012

    Exactly what i needed ! Works like a charm on 1.7.1 thanks !

  14. Go to Top of the page

Leave a comment