Magento config XML for adding a controller action to a core admin controller
Posted
by N. B.
on Stack Overflow
See other posts from Stack Overflow
or by N. B.
Published on 2010-04-29T21:10:06Z
Indexed on
2010/04/29
21:47 UTC
Read the original article
Hit count: 275
magento
I'm trying to add a custom action to a core controller by extending it in a local module. Below I have the class definition which resides in magento1_3_2_2/app/code/local/MyCompany/MyModule/controllers/Catalog/ProductController.php
class MyCompany_MyModule_Catalog_ProductController extends Mage_Adminhtml_Catalog_ProductController
{
public function massAttributeSetAction(){
...
}
}
Here is my config file at magento1_3_2_2/app/code/local/MyCompany/MyModule/etc/config.xml:
...
<global>
<rewrite>
<mycompany_mymodule_catalog_product>
<from><![CDATA[#^/catalog_product/massAttributeSet/#]]></from>
<to>/mymodule/catalog_product/massAttributeSet/</to>
</mycompany_mymodule_catalog_product>
</rewrite>
<admin>
<routers>
<MyCompany_MyModule>
<use>admin</use>
<args>
<module>MyCompany_MyModule</module>
<frontName>MyModule</frontName>
</args>
</MyCompany_MyModule>
</routers>
</admin>
</global>
...
However, https://example.com/index.php/admin/catalog_product/massAttributeSet/ simply yields a admin 404 page. I know that the module is active - other code is executing fine. I feel it's simply a problem with my xml syntax. Am I going about this the write way? I'm hesitant because I'm not actually rewriting a controller method... I'm adding one entirely. However it does make sense in that, the original admin url won't respond to that action name and it will need to be redirected.
I'm using Magento 1.3.2.2
Thanks for any guidance.
© Stack Overflow or respective owner