2011-08-18 58 views
7

我想对我的Magento存储中的Checkout控制器进行一些更改,但是,当我尝试将控制器文件放入本地目录时,它似乎并不尊重本地文件为此。似乎无法覆盖Magento中的Checkout控制器

我已经检查过,这些文件在它们各自的代码池中的相同位置,并且这些文件被命名为相同的东西,它只是不会这样做。

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

这些都是我有两个文件的文件路径。

Magento中的签出文件有什么特别的地方阻止它们被覆盖?

回答

14

仅供参考,仅通过将相关文件放置在具有相同文件夹结构的本地文件夹中,控制器覆盖不起作用。相反,你需要按照下面的语法为宗旨:

<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 
+1

这是Magento的团队一个奇怪的设计决定因为模块内的所有其他内容都可以通过将其置于本地代码池中的正确位置而轻松覆盖。 –