【发布时间】:2012-09-24 13:21:49
【问题描述】:
我正在尝试使用此设置扩展 OnepageController:
app/etc/modules/Custom_Checkout.xml
<config>
<modules>
<Custom_Checkout>
<active>true</active>
<codePool>local</codePool>
</Custom_Checkout>
</modules>
</config>
app/local/Custom/Checkout/etc/config.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Custom_Checkout>
<version>0.0.1</version>
</Custom_Checkout>
</modules>
<frontend>
<routers>
<checkout>
<args>
<modules>
<custom_checkout before="Mage_Checkout">Custom_Checkout</custom_checkout>
</modules>
</args>
</checkout>
</routers>
</frontend>
</config>
app/local/Custom/Checkout/controllers/OnepageController.php
require_once("Mage/Checkout/controllers/OnepageController.php");
class Custom_Checkout_OnepageController extends Mage_Checkout_OnepageController
{
public function indexAction()
{
echo "Index overidden";
}
}
我见过这些: Extend magento core controller (Checkout/OnepageController)
还有一些我无法发布的内容,但上述方法似乎都不起作用。它只是不会覆盖控制器。
关于为什么这不是覆盖的任何想法?
【问题讨论】:
-
你的
app/local/路径应该是app/code/local -
我遇到了同样的问题,调试后我发现有另一个安装的模块已经重载了 OnepageCntroller.php,这就是没有加载正确代码的原因。最好同时检查其他已安装的模块。