Magento模块侧栏不起作用

米歇尔

我正在创建magento模块,以便它可以显示在2列的边栏中。但是,它没有显示在右侧栏上。这是到目前为止的进度:

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上显示并启用。我希望它显示在所有页面上。谢谢。

米歇尔

我自己解决了这个错误的文件夹位置。用于布局和模板的文件夹应放在基本/默认文件夹中,并与布局和模板文件夹合并。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章