2011-08-18 60 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的團隊一個奇怪的設計決定因爲模塊內的所有其他內容都可以通過將其置於本地代碼池中的正確位置而輕鬆覆蓋。 –