Home » Magento

Magento: Admin Controller Override

16 March 2010 3,156 views Popularity: 7% Share/Bookmark

email

I had to override adminhtml controller class (Mage_Adminhtml_System_ConfigController) with my module’s controller class (MyNamespace_MyModule_ConfigController).

It was really tough to find the right solution. I googled, searched in magentocommerce forum and found a lot of solutions. But they didn’t work for me.

After searching & trying more, I got some work done with the following piece of code:-

<global>
	<routers>
		<adminhtml>
		   <rewrite>
			   <system_config>
				   <to>MyNamespace_MyModule/config</to>
				   <override_actions>true</override_actions>
				   <actions>
					   <save>
						   <to>MyNamespace_MyModule/config/save</to>
					   </save>
					   <index>
						   <to>MyNamespace_MyModule/config/index</to>
					   </index>
				   </actions>
			   </system_config>
		   </rewrite>
	   </adminhtml>
	</routers>
</global>

But this gave “404 Error Page not found” when I go to System->Configuration.

Finally, I did the controller override with the following code:-

<global>
	<rewrite>
		<mynamespace_mymodule_config>
			<from><![CDATA[#^/admin/system_config/#]]></from>
			<to>/mymodule/config/</to>
		</mynamespace_mymodule_config>
	</rewrite>
</global>

Hope this helps and thanks for reading.

Related posts:

  1. Magento: Block Controller Model Helper Override
  2. Magento: How to change Currency symbol by Model Override ?
  3. Magento: How to get controller, module, action and router name?
  4. Magento: Access denied in admin of custom module
  5. Magento: Authorize.net not displayed in Payment Information section while Checkout
  6. Magento: How to remove or rename ‘Add New’ button from Admin Grid?
  7. Magento Admin login problem
  8. jQuery: Grey out background and preview image as popup
  9. Magento: How to change Admin URL Path?
  10. Magento: Solution to “Error: 404 Not Found” in Admin Login Page
  • pranay

    Gr8 solution…
    I also suffered by this issue..
    Thanks for the better and right answer.

  • pranay

    Hello Friendz Mukesh,

    This is a nice tutorial..
    for me it working fine in Magento1.4.0.1
    but the same code i m using for Magento version 1.3.2.4
    it’s not working here..

    Please help and suggest me If i was wrong!!!!

  • Aftabnaveed

    it is not working for me :-( I am using 1.4.0.1

  • Tudz

    could you be more explicit with

    /mymodule/config/

    what’s ‘mymodule’ ? is it ‘Adminhtml_System’, ‘system’ or ‘adminhtml’ ?
    could you paste your config.xml?

    and to register the module i used:
    /etc/modules/[namespace]_all.xml

    true
    local

    is this correct?

  • http://blog.chapagain.com.np/ Mukesh

    By “mynamespace”, I mean to say the Namespace you are using for your module.
    By “mymodule”, I mean the name of your Module.

    like.. if you have app/code/local/Apple/Paypal

    thne, Apple is your namespace and Paypal is your module name.

    so.. mynamespace = apple
    and.. mymodule = paypal

    Thanks.

  • derhecht

    Thx. The underscore in the routers reference solved my problem.

  • Dominik

    How to override Mage_Adminhtml_Sales_Order_InvoiceController?