{"id":9769,"date":"2013-03-07T17:56:09","date_gmt":"2013-03-07T12:26:09","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=9769"},"modified":"2013-03-08T13:48:47","modified_gmt":"2013-03-08T08:18:47","slug":"how-to-add-currency-selector-in-header-of-magento","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/how-to-add-currency-selector-in-header-of-magento\/","title":{"rendered":"How to add currency selector in header of Magento"},"content":{"rendered":"<p>\nIn magento by default currency selector renders in right side bar. To show it in the header is not a hard job. This blog will let you know about moving it to header of magento.\n<\/p>\n<p>\nFirst of all setup your desired currencies for your store from magento admin. Now create a new template file and put it under following directory structure :\n<\/p>\n<p>\napp\/design\/frontend\/your_package\/your_theme\/template\/currency\/currency.phtml\n<\/p>\n<p>[php]<br \/>\n&lt;?php if($this-&gt;getCurrencyCount() &gt; 1): ?&gt;<br \/>\n&lt;div class=&quot;form-language&quot;&gt;<br \/>\n    &lt;label for=&quot;currency-selector&quot;&gt;&lt;?php echo $this-&gt;__(Currency&#8217;) ?&gt;&lt;\/label&gt;<br \/>\n    &lt;select onchange=&quot;window.location.href=this.value&quot; name=&quot;currency-selector&quot; id=&quot;currency-selector&quot;&gt;<br \/>\n        &lt;?php foreach ($this-&gt;getCurrencies() as $code =&gt; $name): ?&gt;<br \/>\n        &lt;option value=&quot;&lt;?php echo $this-&gt;getSwitchCurrencyUrl($code)?&gt;&quot;<br \/>\n            &lt;?php if($code == $this-&gt;getCurrentCurrencyCode()): ?&gt;<br \/>\n                selected=&quot;selected&quot;<br \/>\n            &lt;?php endif; ?&gt;&gt;<br \/>\n            &lt;?php echo $name ?&gt;<br \/>\n        &lt;\/option&gt;<br \/>\n        &lt;?php endforeach; ?&gt;<br \/>\n    &lt;\/select&gt;<br \/>\n&lt;\/div&gt;<br \/>\n&lt;?php endif; ?&gt;<br \/>\n[\/php]<\/p>\n<p>\nNow create following file so that magento use this file to render currency selector.\n<\/p>\n<p>\napp\/design\/frontend\/your_package\/your_theme\/layout\/local.xml\n<\/p>\n<p>[php]<br \/>\n&lt;?xml version=&quot;1.0&quot;?&gt;<br \/>\n&lt;layout version=&quot;0.1.0&quot;&gt;<br \/>\n    &lt;default&gt;<br \/>\n        &lt;reference name=&quot;header&quot;&gt;<br \/>\n            &lt;block type=&quot;directory\/currency&quot; name=&quot;my_currency_selector&quot; template=&quot;currency\/currency.phtml&quot;\/&gt;<br \/>\n        &lt;\/reference&gt;<br \/>\n    &lt;\/default&gt;<br \/>\n&lt;\/layout&gt;<br \/>\n[\/php]<\/p>\n<p>\nNow open app\/design\/frontend\/your_package\/your_theme\/page\/html\/header.phtml and add following line :\n<\/p>\n<p>[php]<br \/>\n&lt;?php echo $this-&gt;getChildHtml(&#8216;my_currency_selector&#8217;) ?&gt;<br \/>\n[\/php]<\/p>\n<p>\nThat&#8217;s it. Hope this will help you.\n<\/p>\n<p>\n<br \/>\nRegards,<br \/>\nAmatya Trivedi<br \/>\namatya@intelligrape.com<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In magento by default currency selector renders in right side bar. To show it in the header is not a hard job. This blog will let you know about moving it to header of magento. First of all setup your desired currencies for your store from magento admin. Now create a new template file and [&hellip;]<\/p>\n","protected":false},"author":62,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":4},"categories":[1],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/9769"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/62"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=9769"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/9769\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=9769"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=9769"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=9769"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}