2013-02-21 65 views
0

昨天我爲自己的頭建了一個自定義的貨幣切換器,一切正常。今天,我來設置目錄頁面,發現我需要刪除左列中的標準貨幣切換器,我打開了我的local.xml並添加了一個刪除貨幣。也許愚蠢的選擇,我經過擺弄後得到left.currency被刪除,當我突然注意到我在我的文件之一做了什麼已經停止我的標題自定義貨幣切換器顯示。Magento標題中的自定義貨幣切換器消失了嗎?

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> 

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"> 

測試/默認/模板/貨幣/ 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> 

從我記得這是我需要創建塊,分配自己的立場,並呼籲它。我一直在不停地清理緩存,但是我在貨幣轉換數據中重新加載,刪除並重新測試了本地的「刪除」,刪除了左欄貨幣,現在我刪除了left.currency但最高的那個從來沒有回來。

這些是我目前的文件,所以現在沒有刪除所有的貨幣,我不知道什麼時候這消失了,但我只是一直在玩左側邊欄的東西,在CSS掙扎後我試圖刪除貨幣和因爲我不知道如何引用它試圖殺死所有貨幣,我可以找到,當我twigged我不再確定當我刪除頂級貨幣。

回答

2

嘗試改變type="template/currency"type="directory/currency"

+0

由於工作就像一個魅力,但我不知道爲什麼。 – 2013-02-22 09:21:04

+1

您指定了'template/currency',其中不存在該名稱的塊類型。在您的佈局xml文件(app/design/frontend/base/default/layout)中,您會找到一個名爲'directory.xml'的文件來引用貨幣的塊類型。它指向'template =「directory/currency.phtml」'帶有'block type =「directory/currency」'。如果塊類型是「模板/貨幣」,那麼你的代碼就可以工作。我希望這可以清楚一點。 – seanbreeden 2013-02-22 15:07:47