2015-10-18 42 views
1

我創建了magento模塊,因此它可以顯示在2列側邊欄上。但是,它並未顯示在右側欄中。這是迄今爲止的進展:Magento模塊邊欄不工作

的Config.xml

<config> 
<modules> 

    <!-- 
     This must exactly match the namespace and module's folder 
     names, with directory separators replaced by underscores 
    --> 
    <Michael_Zipcode> 

     <!-- The version of our module, starting at 0.0.1 --> 
     <version>0.0.1</version> 

    </Michael_Zipcode> 

</modules> 

<global> 

    <blocks> 
     <zipcode> 
      <class>Michael_Zipcode_Block</class> 
     </zipcode> 
    </blocks> 

</global> 

<frontend> 
    <layout> 
     <updates> 
      <zipcode> 
       <file>zipcodesidebar.xml</file> 
      </zipcode> 
     </updates> 
    </layout> 
</frontend> 
</config> 

zipcodesidebar.xml

<?xml version="1.0"?> 

<layout version="0.1.0"> 
<default> 
    <reference name="right"> 
     <block type="zipcode/filter" name="michael.zipcode" template="zipcode/enterzip.phtml"/> 
    </reference> 
</default> 
</layout> 

Filter.php

<?php 

class Michael_Zipcode_Block_Filter extends Mage_Core_Block_Template { 

public function __construct() 
{ 
    parent::__construct(); 
    $this->setTemplate('zipcode/enterzip.phtml'); 
} 

public function getFilter() { 
    //die('ok'); 
    return 'enter code area'; 
} 

}?> 

enterzip.phtml

<?php 
echo $this->getFilter(); 
?>test 

據說打印輸入代碼區在右側。該模塊已在adminhtml上顯示並啓用。我期待它顯示在所有頁面上。謝謝。

回答

0

解決它自己,錯誤的文件夾位置。佈局和模板的文件夾應放在基本/默認文件夾中,並與佈局和模板文件夾合併。