为什么我的 Magento Catalog ProductController 没有被扩展?
Why is my Magento Catalog ProductController not being extended?
我正在尝试扩展我的 Magento 目录 ProductController 视图
(准确地说 Mage_Checkout_CartController::ViewAction)并且 Magento 似乎不承认模块扩展。
所以我有以下文件:
这是 /app/code/local/Mage/SwapMachine/etc/config.xml 配置文件
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Mage_SwapMachine>
<version>0.1.0</version>
</Mage_SwapMachine>
</modules>
<frontend>
<routers>
<swapmachine>
<args>
<modules>
<Mage_SwapMachine before="Mage_Catalog">Mage_SwapMachine_Frontend</Mage_SwapMachine>
</modules>
</args>
</swapmachine>
</routers>
</frontend>
</config>
这是 /app/design/frontend/base/default/layout/swapmachine.xml 文件。正如我被指示从源代码 #2(底部的源代码)创建的那样
<?xml version="1.0"?>
<mage_swapmachine_frontend>
<update handle="catalog_product_view"/>
</mage_swapmachine_frontend>
这是 /app/code/local/Mage/SwapMachine/controllers/Frontend/ProductController.php 文件
<?php
include(Mage::getBaseDir()."/app/code/core/Mage/Catalog/controllers/ProductController.php");
class Mage_SwapMachine_Frontend_ProductController extends Mage_Catalog_ProductController
{
public function viewAction()
{
/// Get initial data from request
die("IT'S WORKING!");
}
}
我已经尝试自己解决这个问题已经有一个星期了,但我感到迷茫。我先按照这里的信息。
来源 1
Magento Catalog ProductController rewrite
经过多次尝试后,我后来发现了这个并尝试了这里的信息,尽管它是针对 Magento 2 的。
来源 2
https://magento2.atlassian.net/wiki/display/m1wiki/How+To+Overload+a+Controller
当您尝试覆盖目录模块时,XML 应如下所示:
<frontend>
<routers>
<catalog>
我正在尝试扩展我的 Magento 目录 ProductController 视图 (准确地说 Mage_Checkout_CartController::ViewAction)并且 Magento 似乎不承认模块扩展。
所以我有以下文件:
这是 /app/code/local/Mage/SwapMachine/etc/config.xml 配置文件
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Mage_SwapMachine>
<version>0.1.0</version>
</Mage_SwapMachine>
</modules>
<frontend>
<routers>
<swapmachine>
<args>
<modules>
<Mage_SwapMachine before="Mage_Catalog">Mage_SwapMachine_Frontend</Mage_SwapMachine>
</modules>
</args>
</swapmachine>
</routers>
</frontend>
</config>
这是 /app/design/frontend/base/default/layout/swapmachine.xml 文件。正如我被指示从源代码 #2(底部的源代码)创建的那样
<?xml version="1.0"?>
<mage_swapmachine_frontend>
<update handle="catalog_product_view"/>
</mage_swapmachine_frontend>
这是 /app/code/local/Mage/SwapMachine/controllers/Frontend/ProductController.php 文件
<?php
include(Mage::getBaseDir()."/app/code/core/Mage/Catalog/controllers/ProductController.php");
class Mage_SwapMachine_Frontend_ProductController extends Mage_Catalog_ProductController
{
public function viewAction()
{
/// Get initial data from request
die("IT'S WORKING!");
}
}
我已经尝试自己解决这个问题已经有一个星期了,但我感到迷茫。我先按照这里的信息。
来源 1
Magento Catalog ProductController rewrite
经过多次尝试后,我后来发现了这个并尝试了这里的信息,尽管它是针对 Magento 2 的。
来源 2
https://magento2.atlassian.net/wiki/display/m1wiki/How+To+Overload+a+Controller
当您尝试覆盖目录模块时,XML 应如下所示:
<frontend>
<routers>
<catalog>