Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 3 of 3
How do I show the currency switcher on the home page? 
 
XinSynergy
Jr. Member
 
Avatar
Total Posts:  19
Joined:  2010-02-18
Singapore
 
Ravikumar N B - 12 April 2009 07:35 PM

Add the below content in home page CMS custom design

<reference name="left">
<
block type="directory/currency" name="currency" before="left.permanent.callout" template="directory/currency.phtml"/>
</
reference>

Hi Ravi,

I’ve a static block setup for every page. How do I convert your above xml codes to html to be added in my existing static block?
Appreciate your help, TIA…

 
Magento Community Magento Community
Magento Community
Magento Community
 
freshshop
Sr. Member
 
Avatar
Total Posts:  88
Joined:  2009-03-07
 
Ravikumar N B - 24 February 2009 08:27 PM

You should modify few layout and templates.

Magento base layout is located in /magento/app/design/frontend/default/default/layout/page.xml, in that xml add currency block under header block.

Modify the header module into

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

Header template is located in /magento/app/design/frontend/default/default/template/page/html/header.phtml
Add one line after store_language (line: 38)
<?php echo $this->getChildHtml('currency'?>

Clear your cache and reload your site.

Note: If currency list box is little lengthy then modify the currency template(/magento/app/design/frontend/default/default/template/directory/currency.phtm).

This workded great for me. But I just wanted the currency switcher in header so in oder to eliminate or hide it from the sidebar I edited layout/directory.xml and changed every

<reference name="left">
to
<reference name="top">
.
This way it disapeared from the sidebar and is only visible on the header.
 
Magento Community Magento Community
Magento Community
Magento Community
 
webrightnow
Member
 
Avatar
Total Posts:  65
Joined:  2010-01-23
Glasgow
 

Ok, this is an ancient topic but I thought someone here might be able to help.

I am at my wits end after a whole day trying to get this currency switcher to show up ANYWHERE in my store. Preferably in the header, but at the moment it simply won’t show anywhere.

I have read every guide available and these are the steps I have taken:

- Set up multiple currency rates under System > Configuration > Currency Setup (GBP, USD, EUR).
- Went to System > Manage Currency Rates > Imported Rates> Saved > Cleared cache
- Created template currency.phtml under app/design/frontend/default/MYTHEME/template/directory with the code:

<?php
/**
 * Currency switcher
 *
 * @see Mage_Directory_Block_Currency
 */
?>
<?php 
if($this->getCurrencyCount()>1): ?>
<div class="block block-currency">
    <
div class="block-title">
        <
strong><span><?php echo $this->__('Select Your Currency'?></span></strong>
    </
div>
    <
div class="block-content">
        <
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; ?>
- Called up the currency template from app/design/frontend/default/MYTHEME/layout/page.xml with the 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"/>
                <
block type="directory/currency" name="currency" template="directory/currency.phtml"/>
                <
block type="core/text_list" name="top.menu" as="topMenu"/>
                <
block type="checkout/cart_sidebar" name="headerCart" as="headerCart" template="checkout/cart/header.phtml"/>
            </
block>
- ALSO called it up from a local.xml file just to see if it would make any difference:
<?xml version="1.0"?>
<layout version="0.1.0">
    <default>
     <
reference name="header">
          <
block type="directory/currency" name="currency" template="directory/currency.phtml"/>
     </
reference>
 </default>
</
layout>
- Went to app/design/frontend/default/MYTHEME/template/page/html/header.phtml and added code:
<?php echo $this->getChildHtml('store_language'?>
         <?php 
echo $this->getChildHtml('currency'?>
        <?php 
echo $this->getChildHtml('headerCart'?>
Store switcher is showing fine, so is the cart text. No currency selector.
- I checked that there was no code anywhere in my layout files set to remove the currency block. There isn’t.

I went through all the steps a million times, cleared the cache more times than I care to remember.

What the...?

Please someone help before I have a serious fit of rage and delete Magento altogether!

 
Magento Community Magento Community
Magento Community
Magento Community
 
webrightnow
Member
 
Avatar
Total Posts:  65
Joined:  2010-01-23
Glasgow
 
magentodesignin - 08 February 2013 03:03 AM

If you want to put in header than in layout/directory.xml put like this

<reference name="header">
<block type="directory/currency" name="currency" template="directory/currency.phtml"/>
</reference>

And call in template/header.phtml file as <?php echo $this->getChildHtml('currency') ?>

Thanks, I tried that but nothing shows up.

Any more ideas?

 
Magento Community Magento Community
Magento Community
Magento Community
 
webrightnow
Member
 
Avatar
Total Posts:  65
Joined:  2010-01-23
Glasgow
 

Fixed it. In case this helps anyone, this is what had happened:

I have two stores under the same Magento installation: an English one and an Italian one. Although I had enabled the three different currencies (GBP, EUR, USD) in the Defaul Config settings under “Current Configuration Scope”, when I switched to one of the individual store views only one currency was enabled. After enabling all three currencies in each store view, the currency switcher is now appearing as expected.

Phew… Mission accomplished.

In brief: if you run multiple stores, remember to enable all different currencies under each store’s configuration scope if you want the currency switcher to show up.

“It’s only easy when you know the answer”

 
Magento Community Magento Community
Magento Community
Magento Community
 
FMEExtensions
Mentor
 
Avatar
Total Posts:  1298
Joined:  2009-08-07
 

We have a magento currency switcher for this purpose.

Tested for 1.4 and above.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 3 of 3