Overriding Magento Admin Controller, for Beginners

匿名 (未验证) 提交于 2019-12-03 08:57:35

问题:

In the Magento Admin section, I want to override the "Sales/Order/ShipmentController.php" controller file of the core Mage.

I have tried rewriting the URL, using the "from" & "to" tags, but in vain.
I don't know what is the actual & correct way of doing this, as I'm a newbie in Magento.

Please anybody provide some good fundamental & correct answer, so that at least the concept gets clear.

Also, if possible, please tell me, what is the actual purpose of the controller, for both the frontend & the back-end?

Any help is greatly appreciated.

回答1:

Not sure what you are talking about with "from" and "to" tags... What you need to do is write a simple custom module (the best way), or just override the controller by putting it in the /app/code/local/ directory.

[Edit] - I wrote a post that covers overriding the different Magento elements, controllers included: http://prattski.com/2010/06/24/magento-overriding-core-files-blocks-models-resources-controllers/

I hope that helps.



回答2:

The correct method for overriding a controller is specified here : http://www.magentocommerce.com/boards/viewthread/16224/

The method of copying files from the core to local is not good. Doing so in this way means that you can only be sure that your custom module will work with the version of Magento that YOU are using. If you want the best chance of your module being compatible with other versions, it needs to be loosely coupled - extending and overriding the functions necessary for your purposes



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!