Override Controllers in Magento
May 30, 2011 16:41
Sometimes you may have to override the core controllers to add some specific functions, don’t know how to override them? Just simply follow below:
If you want to override the some controllers in adminhtml module for admin, add the following XML to your own module’s config.xml:
<config> .... <admin> <routers> <adminhtml> <args> <modules> <my_Module before="Mage_Adminhtml">MyNameSpace_MyModule_Adminhtml</my_Module> </modules> </args> </adminhtml> </routers> </admin> ... </config>
If you want to override the some controllers in checkout module for frontend, add the following XML to your own module’s config.xml:
<config> ... <frontend> <routers> <checkout> <args> <modules> <module before="Mage_Checkout">MyNameSpace_MyModule_Checkout</module> </modules> </args> </checkout> </routers> </frontend> ... </config>
That is, easy?
Happy Magento’ing ~
First phase is to make and position files in your component that will bypass Magento’s primary operator. On to that part:
1.First, make this computer file in same directory structure: app/code/local/Inchoo/Coreextended/controllers/Frontend/Customer/AccountController.php.
2.Then make xml for our component situated here: app/code/local/Inchoo/Coreextended/etc/config.xml
3.And lastly, make this computer file app/etc/modules/Inchoo_Coreextended.xml.