3
votes

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.

2
Is there a specific action or block you want to override, or are you changing all actions on the controller in some fundamental way? - Joseph Mastey
No, I want to override only the save action of the shipment controller of the sales module, in the admin area - Knowledge Craving
If SO users find this post useful, then please upvote this question & also upvote the useful answers as well. - Knowledge Craving

2 Answers

7
votes

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

5
votes

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.