Magento: Admin Controller Override

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. Thanks.