2
votes

I have a custom module Permissions_Orders. Here is my code to override orders controller from base admin -

config.xml -

<admin>   
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <orders before="Mage_Adminhtml">Orders_Adminhtml_Sales_OrderController</orders>
                    </modules>
                </args>
            </adminhtml>
        </routers> 
    </admin>

Permissions/Orders/controllers/Adminhtml/Sales/OrderController.php -

<?php
require_once 'Mage/Adminhtml/controllers/Sales/OrderController.php';

class Permissions_Orders_Adminhtml_Sales_OrderController extends Mage_Adminhtml_Sales_OrderController
{

----
}

but still it is calling from base controller. I am not sure, where I am wrong here. Any help is appreciated.

2

2 Answers

0
votes

Your config.xml should look like below,

<config>    
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <orders before="Mage_Adminhtml">Permissions_Orders_Adminhtml</orders>                        
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
</config>

Notice the change in </orders> node.

0
votes

In config.xml is enough to specify the namespace and module name where you want to extend the base adminhtml controllers.

<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <Namespace_Adminhtml before="Mage_Adminhtml">Namespace_Adminhtml</Namespace_Adminhtml>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>