Reputation: 479
I am trying to override a controller from the core (Mage/Adminhtml/controllers/Sales/Order/InvoiceController).
My code for this in my custom modules' config.xml:
<modules>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<Mycompany_Mymodule before="Mage_Adminhtml">Mycompany_Mymodule_Adminhtml</Mycompany_Mymodule>
</modules>
</args>
</adminhtml>
</routers>
</admin>
</modules>
My controller file is located at: local/mycompany/mymodule/controllers/adminhtml/dueperiodcontroller.php
The route doesn't get here (still uses the core controller).
There might be a way to use mycompany/adminhtml as module and place everything in here. Does this work?
And preferably an easy fix for the way I already did.
Upvotes: 0
Views: 3872
Reputation: 21
>
<config>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<Mycompany_Mymodule before="Mage_Adminhtml">Mycompany_Mymodule_Adminhtml</Mycompany_Mymodule>
</modules>
</args>
</adminhtml>
</routers>
</admin>
</config>
Place controller file under the same directory structure and should have same name
local/mycompany/mymodule/controllers/Adminhtml/Sales/Order/InvoiceController.php
use class name as follows
>
require_once 'Mage/Adminhtml/controllers/Sales/Order/InvoiceController';
class mycompany_mymodule_Adminhtml_Sales_Order_InvoiceController extends Mage_Adminhtml_Sales_Order_InvoiceController
Upvotes: 2