似乎无法覆盖 Magento 中的结帐控制器 [英] Can't seem to override Checkout Controller in Magento

查看:30
本文介绍了似乎无法覆盖 Magento 中的结帐控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试对 Magento 商店中的 Checkout 控制器进行一些更改,但是,当我尝试将控制器文件放入我的本地目录时,它似乎并没有为此尊重本地文件.

我已经检查过这些文件在它们各自的代码池中是否位于同一位置,并且这些文件的名称相同,但它不会这样做.

  • /app/code/core/Mage/Checkout/controllers|CartController.php
  • /app/code/local/Mage/Checkout/controllers|CartController.php

这些是我拥有的两个文件的文件路径.

Magento 中的结帐文件有什么特别之处可以防止它们被覆盖吗?

解决方案

仅供参考,控制器覆盖仅通过将相关文件放置在具有相同文件夹结构的本地文件夹中不起作用.相反,您需要遵循以下语法:

<前端>[1]<路由器><结帐>[2]<参数><模块><yourModule before="Mage_Checkout">Namespace_Module_Overwrite_Checkout</yourModule>[3]</模块></args></结帐></路由器></前端></config>

<前>[1] 取决于控制器区域,前端"或管理员"[2] 要覆盖的模块的路由器节点(在该模块的 config.xml 中查找)[3] 标签可以是任何东西,它在节点内必须是唯一的.Your_Module_Overwrite_Checkout(映射到目录)您的/模块/控制器/覆盖/结帐/希望这可以帮助.问候魔法魔法师

I am trying to make some changes to the Checkout controller in my Magento store, however, when I try to put the controller file into my local directory it does not seem to be respecting the local file for this.

I have checked that the files are in the same spot in their respective code pools and the files are named the same thing, it just will not do it.

  • /app/code/core/Mage/Checkout/controllers|CartController.php
  • /app/code/local/Mage/Checkout/controllers|CartController.php

Those are the file paths for the two files I have.

Is there something special about the checkout files in Magento that prevent them from being overridden?

解决方案

FYI, controller overriding doesn't work just by placing the related file in local folder with the same folder structure. Rather you need to follow the following syntax for the purpose:

<config>
    <frontend> [1]
        <routers>
            <checkout> [2]
                <args>
                    <modules>
                        <yourModule before="Mage_Checkout">Namespace_Module_Overwrite_Checkout</yourModule> [3]
                    </modules>
                </args>
            </checkout>
        </routers>
    </frontend>
</config>

[1] Depending on the controllers area ,"frontend" or "admin"
[2] Router node of the module to be overridden (look it up in the config.xml of that module)
[3] The tag  can be anything, it must be unique within the  node.
Your_Module_Overwrite_Checkout (is mapped to directory)
Your/Module/controllers/Overwrite/Checkout/

Hope this helps.
Regards
MagePsycho

这篇关于似乎无法覆盖 Magento 中的结帐控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆