29 November

Displaying “Select Your Currency” block

: 12 Comments

The Core of Magento has already a file currency.phtml in app/design/frontend/base/default/template/directory   This block should show up if you select more than one currency in your admin-panel (System > Configuration >Currency Setup ) and then configure them in (System > Manage Currency Rates ) but there are situations where after configure this, the block still not showing up.

So, first of all, after configure the currency in the admin-panel, add this line of code in your catalog.xml (appdesignfrontenddefaultyourthemelayoutcatalog.xml):

In the <!– Mage_Catalog –> section, under <reference name=”right”> or <reference name=”left”> (depends of your Theme) add this:

<block type=”directory/currency” name=”currency” template=”directory/currency.phtml”/>

If your “Select Your Currency” block still not showing, you should do the following:

Create a currency.phtml file in the following directory:

appdesignfrontenddefaultyourthemetemplatedirectorycurrency.phtml

If you don’t have a “directory” folder, so create it!

The new currency.phtml has to be filled with this code:

<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category    design
* @package     base_default
* @copyright   Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
* @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*/
?>
<?php
/**
* Currency switcher
*
* @see Mage_Directory_Block_Currency
*/
?>
<?php if($this->getCurrencyCount()>1): ?>
<div>
<div>
</div>
<div>
<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>
</div>
</div>
<?php endif; ?>

Then, you have to give it style, going to your styles.css, add or modify this:

.block-currency .head {
background-image:url(“../images/select_your_currency.gif”);
background-position:0 0;
background-repeat:no-repeat;
}

  • http://www.theluckylabs.com Steven

    This doesn’t work for me. As soon as I place that line in my catalog.xml file, I get the following error:

    Fatal error: Call to a member function addToChildGroup() on a non-object in /home/thelucky/public_html/app/code/core/Mage/Core/Block/Abstract.php on line 654

  • bobby you

    hi,i created “directory” folder,and currency.phtml but still no Displaying “Select Your Currency” block,you see http://www.yaabay.com

  • http://www.buypenisenlargement.com penis enlargement

    This is such a great resource that you are providing and you give it away for free. I love seeing websites that understand the value of providing a quality resource for free. It?s the old what goes around comes around routine. XR2011K6

  • hapi

    i think above approach doesn’t work for magento 1.5.0.1,i even did not find the directory in the theme file.:(

  • http://www.gsdfind.com/ Gadgets

    greate!! it is work thank you !!

  • http://www.sina.com.cn/ xixihaha567

    We’re a group of volunteers and beginning a new initiative in our community. Your weblog supplied us with valuable info to work on|.You have done an impressive job!

  • http://www.ecoobe.com Luca

    Hello guys,
    this does not work at all in HelloStyle theme. I fixed a lot of bugs and missing code in this theme, if I would wrote it from scratch for sure was the faster way but I already payed and I would want it working. The last bug is the currency but I don’t find a way to have it working and opening a ticket to the hellotheme team is completelly unusefull… someone there have the solution to show the multi currency swith?
    Thanks

  • http://agrais.com Agrais Solutions

    The code:
    block type=”directory/currency” name=”currency” template=”directory/currency.phtml”/>

    is wrong the correct is the following:

    Your work is great, thank you.

  • http://agrais.com Agrais Solutions

    The code:

    is wrong the correct is the following:

    Your work is great, thank you.

  • http://agrais.com Agrais Solutions

    The code:
    block type=”directory/currency” name=”currency” template=”directory/currency.phtml”/>

    is wrong the correct is the following:
    block type=”directory/currency” name=”directory.currency” template=”directory/currency.phtml”/>

    Your work is great, thank you.
    (Sorry, something happends with the others comments)

  • http://www.magentocommerce.com.sg/ magento developer

    I have attempted to install Magento e-commerce on my web server with Webcity.com.au, and have begun the install.php process, but in the third step I always get a message saying “PHP Extension “pdo_mysql” must be loaded”. What us pdo_mysql and how do I install this on the server?

  • deck contractor

    I like this weblog very much, Its a real nice place to read and incur information.

Back to Top