扩展Magento checkout CartController.php

时间:2016-09-21 07:17:02

标签: magento controller extend

我需要一些帮助扩展magento CartController,我在网上发现了很多教程,但是没有任何结果,这是我到目前为止所得到的:

  

config.xml中

<?xml version="1.0" encoding="UTF-8"?>
    <config>
        <modules>
            <Juist_Overwrite>
                <version>0.1.0</version>
            </Juist_Overwrite>
        </modules>
        <frontend>
            <routers>
                <Juist_Overwrite>
                    <use>standard</use>
                    <args>
                        <module>Juist_Overwrite</module>
                        <frontName>overwrite</frontName>
                    </args>
                </Juist_Overwrite>
            </routers>
        </frontend>
        <global>
            <routers>
                <checkout>
                    <rewrite>
                        <cart>
                            <to>overwrite/cart</to>
                            <override_actions>true</override_actions>
                            <actions>
                                <add>
                                    <to>overwrite/cart/index</to>
                                </add>
                            </actions>
                        </cart>
                    </rewrite>
                </checkout>
            </routers>
        </global>
    </config>
  

CartController.php

 <?php

    require_once 'Mage/Checkout/controllers/CartController.php';

    class Juist_Overwrite_CartController extends Mage_Checkout_CartController
    {
        public function addAction()
        {
            parent::addAction();

            echo 'Test';
        }

        public function indexAction()
        {
            parent::indexAction();

            echo 'Test';
        }
    }
  

请参阅下面的结果,测试变量按预期打印,但是   内容区域保持白色,没有加载布局

See the result below, the test is printed as expected, however the content area stays white, none of the layout is loaded

如何只扩展CartController.php?

0 个答案:

没有答案