You need to add currency dropdown as child block of toplink
using layout xml code.
Create local.xml at app/design/frontend/your package/your template//layout/
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<reference name="top.links">
<block type="directory/currency" name="currencytop" template="directory/currency.phtml"/>
</reference>
</default>
</layout>
Create a new template file topcurrency.phtml
at app/design/frontend/your package/your template/template/directory
and your code.
<?php if($this->getCurrencyCount()>1): ?>
<div class="block block-currency">
<div class="block-content">
<select name="currency" onchange="setLocation(this.value)">
<?php foreach ($this->getCurrencies() as $_code => $_name): ?>
<option>
<a href="<?php echo $this->getSwitchCurrencyUrl($_code) ?>" title="<?php echo $_code ?>" <?php if($_code==$this->getCurrentCurrencyCode()): ?> class="selected"<?php endif; ?>>
<?php echo Mage::app()->getLocale()->currency($_code)->getSymbol()?>
</a>
</option>
<?php endforeach; ?>
</select>
</div>
<div class="block-title-currency">
<strong><span><?php echo $this->__('Currencies') ?></span></strong>
</div>
</div>
<?php endif; ?>
then in links.phtml call this template file as child block using below code:
<?php echo $this->getChildHtml('currencytop');?>
I spent a few hours investigating this. I agree it is the same code due to
file: magento/app/design/frontend/rwd/default/layout/directory.xml
<default>
<reference name="head">
<block type="core/template" name="optional_zip_countries" as="optional_zip_countries" template="directory/js/optional_zip_countries.phtml" />
</reference>
<reference name="header">
<block type="directory/currency" name="currency" as="currency_switcher" template="directory/currency.phtml"/>
</reference>
<reference name="footer">
<block type="directory/currency" name="footer_currency" after="footer_store_language" template="directory/currency.phtml"/>
</reference>
</default>
The big difference is that the footer block is cached. You can make the footer currency changeer show the correct currency if you refresh the BLOCK_HTML cache in the Magento admin and then refresh the front page in your browser.
The RWD development team seem to have missed this in its test phase. I think you have uncovered a genuine bug in the RWD theme.
How to fix it?
Well I am not a Magento expert for sure and I would have thought adjusting
<?php echo $this->getChildHtml() ?>
to
<?php echo $this->getChildHtml('',false,true) ?>
in
file: magento/app/design/fromtend/rwd/default/template/page/html/footer.phtml
and
<?php echo $this->getChildHtml('footer') ?>
to
<?php echo $this->getChildHtml('footer',false,true) ?>
in
file: magento/app/design/frontend/rwd/default/template/page/3columns.phtml
with reference to:
file: magento/app/code/core/Mage/Page/Block/Html/Footer.php
public function getChildHtml($name='', $useCache=true, $sorted=true)
{
return parent::getChildHtml($name, $useCache, $sorted);
}
would have solved it (by requesting the childHtml not be built from the cache). But Magento cacheing remains an enigma to me. Maybe you know more about it and can resolve this by .phtml file manipulation alone.
The solution I have for you is to extend the class Mage_Page_Block_Html_Footer
(file magento/app/code/core/Mage/Page/Block/Html/Footer.php
) and rewrite the function getCacheKeyInfo()
to add a currency code to the cache key. This has the advantage that you can continue to benefit from the speed enhancement of the Magento cache:
file: magento/app/code/core/Mage/Page/Block/Html/Footer.php
/**
* Get cache key informative items
*
* @return array
*/
public function getCacheKeyInfo()
{
return array(
'PAGE_FOOTER',
Mage::app()->getStore()->getId(),
(int)Mage::app()->getStore()->isCurrentlySecure(),
Mage::getDesign()->getPackageName(),
Mage::getDesign()->getTheme('template'),
Mage::getSingleton('customer/session')->isLoggedIn(),
//an extra line for when the currency switcher is in the footer:
Mage::app()->getStore()->getCurrentCurrency()->getCode()
);
}
Are you familiar with creating your own module and rewriting classes? - That is the way to put this new cache key into your theme rather than editing the core class file.
Best Answer
copy file:
to
After that you need to remove
Currency code
.Code responsible for showing currency code is:
Above code will remove active currency code. For other currency code you need to remove:
from
li
Before edit:
After Edit:
Hope above will help!