Magento重写IndexController模板类

时间:2014-01-29 23:51:54

标签: magento

我在Magento上复制了一个模板,其功能是显示一个集合产品。

在我的IndexController中,我有这个电话:

class Yuka_Catalogue_IndexController extends Mage_Core_Controller_Front_Action

它的主要功能是:

$category = Mage::getModel('catalog/category')->load(18);    

所以我想创建一个新模板,以便我可以加载另一个类别(这次我想调用类别编号44)。

原始模块(Yuka_Catalogue.xml)声明如下:

<?xml version="1.0"?>

<config>
    <modules>
        <Yuka_Catalogue>
            <active>true</active>
            <codePool>local</codePool>
        </Yuka_Catalogue>
    </modules>
</config>

所以我创建了一个新的Yuka_Catalogue2014.xml并将其声明为:

<config>
    <modules>
        <Yuka_Catalogue2014>
            <active>true</active>
            <codePool>local</codePool>
        </Yuka_Catalogue2014>
    </modules>
</config>

然后我添加了catalogue2014.phtml(作为catalogue.phtml的副本,唯一的区别是它调用类别44。

在我的/ code / local等中 我有这个config.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Yuka_Catalogue2014>
            <version>0.0.1</version>
        </Yuka_Catalogue2014>
    </modules>
    <frontend>
        <routers>
            <Yuka_Catalogue2014>
                <use>standard</use>
                <args>
                    <module>Yuka_Catalogue2014</module>
                    <frontName>catalogue2014</frontName>
                </args>                                                                                                                                                                                                                                                             
            </Yuka_Catalogue2014>                     
        </routers>
    </frontend>
</config> 

最后,所有内容都已正确更新(类别已更改)。 问题是,当尝试加载以下产品时,似乎加载的IndexController是原始的,因为它会回到以前的类别。

我已宣布class Yuka_Catalogue2014_IndexController extends Mage_Core_Controller_Front_Action 但它似乎在我的IndexController中没有活动。 如果有人知道如何强制Magento在加载实际模块后覆盖控制器。

感谢您的帮助

0 个答案:

没有答案