How to Override frontend Order Controller in Magento

Here, I am overriding the Order frontend Controller without using the [rewrite] node.
This is the simple and better way to override the any controller (frontend / admin) using [routers] node.

I am taking the example of frontend Order controller, please look at the below steps:
Note : 1 ) Replace all [ with < and ] with >
           2) Please follows the case sensitiveness.
1) In config.xml file do the following changes:
[frontend]
   [routers]
      [sales]
        [args]
          [modules]
             [namespace before="Mage_Sales"] Namespace_Sales   [/namespace]
          [/modules]
       [/args]
    [/sales]
  [/routers]
[/frontend]

2) In Namespace/Sales/controllers/OrderController.php file

require_once('Mage/Sales/controllers/OrderController.php')
Class Namespace_Sales_OrderController extends Mage_Sales_OrderController
{
     public function reorderAction()
     {
           Write your code or logic here.......:)
     }
}


----- --  done --------
How to Override frontend Order Controller in Magento How to Override frontend Order Controller in Magento Reviewed by Pranay Gondane on 11:00:00 AM Rating: 5

No comments

Free! Free!Free! Subscribe to Get Free PHP (Magento) tutorial Update in Your Inbox!!! Hurry Up!!!