Action Level Controller Rewriting

Time to reactivate writing #tweetorials. Today a little information on controller rewrites (there are many ways to do this in Magento).

The official best practice to rewrite controllers is to use the config/[area]/routers/[route]/args/modules/ node. This is covered elsewhere.

Or see the code that evaluates this configuration at Mage_Core_Controller_Varien_Router_Standard::collectRoutes() (ref http://alanstorm.com/magento_dispatch_standard_router)

The information I want to share is that the controller is NOT only matched by it’s file name (e.g Sales/OrderController.php)

If the requested action isn’t implemented on a controller class, Magento will continue to look through the list of modules for a match.

So don’t extend the parent class you are rewriting unless you have to. This will let other modules rewrite other methods if needed.