Search code examples
magentoblockmagento-1.7

Custom currency switcher in Magento header vanished?


I built a custom currency switcher for my header yesterday, all working well. Today I came to setup the catalog pages and found myself needing to remove the standard currency switcher in the left column, I opened up my local.xml and add a remove to currency. Silly choice perhaps, I managed after fiddleing to get the left.currency to be removed when i suddenly noticed something I had done in one of my files had stopped my header custom currency switcher from displaying.

local.xml

<?xml version="1.0" encoding="UTF-8"?>
    <layout>
    <default>
    <!-- Remove callouts and rarely used stuff -->
    <remove name="right.poll"/>
    <remove name="right.permanent.callout"/>
    <remove name="left.permanent.callout"/>
    <remove name="paypal.partner.right.logo"/>
    <remove name="catalog.compare.list" />

    <!-- add the local stylesheet -->
    <reference name="head">
        <action method="addCss"><stylesheet>css/smoothness/jquery-ui-1.10.1.custom.css</stylesheet></action>
        <action method="addJs"><script>ahoy/jquery-1.9.1.js</script></action>
        <action method="addJs"><script>ahoy/jquery-ui-1.10.1.custom.js</script></action>
        <action method="addJs"><script>ahoy/script.js</script></action>

        <action method="addCss"><stylesheet>css/1140.css</stylesheet></action>
        <action method="addCss"><stylesheet>css/ahoy.css</stylesheet></action>          
    </reference>
    <reference name="header">
        <block type="template/currency" name="custom_currency_selector" template="currency/currency.phtml"/>
    </reference>

</default>

<catalog_category_view>
    <reference name="root">
        <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
    </reference>
</catalog_category_view>

First part of header.phtml

<div class="header">
<div class="row">
    <div class="row">   
        <div class="sixcol">
            <?php echo $this->getChildHtml('topLinks') ?>
            <?php echo $this->getChildHtml('custom_currency_selector') ?>
        </div>
        <div class="sixcol last">
            <div class="row">

test/default/template/currency/currency.phtml

<?php if($this->getCurrencyCount() > 1): ?>
<div class="currency-block">
<ul>
    <?php foreach ($this->getCurrencies() as $_code => $_name): ?>

    <?php $active = ($_code==$this->getCurrentCurrencyCode()) ? "active":""; ?>
    <li>
        <a class="<?php echo $active; ?>" href="<?php echo $this->getSwitchCurrencyUrl() . "currency/" . $_code; ?>" title="Set <?php echo $_code; ?> as your chosen currency">
            <?php echo Mage::app()->getLocale()->currency($_code)->getSymbol(); ?>
        </a>
    </li>
    <?php endforeach; ?>
</ul>

From what I remember this is all I need to create the block, assign its position and call it out. I've been clearing the cache constantly while fiddeling, I reloaded in the currency conversion data, removed and retested the "remove" in local that removed the left bars currency, that one has now come back after i removed the remove for left.currency but the top one never came back.

These are my current files, so no removes at all for currency now, I'm not sure when this vanished but I've only been playing with the left sidebar stuff, after css struggles i tried to remove the currency and as i did not know how to reference it tried killing off all currency i could find and when i twigged i was no longer sure when i removed the top currency.


Solution

  • Try changing type="template/currency" to type="directory/currency"