0

I have 2 modules using the OrderController.php

One of them overrides deleteorderAction and the other one overrides addCommentAction

Only the deleteorderAction is rewrited but the addCommentAction doesnt work anymore

In the config.xml from ModuleB I have:

<?xml version="1.0"?>
<config>
<modules>
    <ModuleB_AdminhtmlControllers>
        <version>1.0.0</version>
    </ModuleB_AdminhtmlControllers>
</modules>

<admin>
    <routers>
        <adminhtml>
            <use>admin</use> 
            <args>
                <modules>
                    <ModuleB_AdminhtmlControllers before="EM_DeleteOrder">ModuleB_AdminhtmlControllers</ModuleB_AdminhtmlControllers>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>
</config>

The config.xml from EM_DeleteOrder:

<?xml version="1.0"?>
<config>
<modules>
    <EM_DeleteOrder>
        <version>1.0.0</version>
    </EM_DeleteOrder>
</modules>
<global>
    <rewrite>
    <em_emadmin_adminhtml_sales_order>
        <from><![CDATA[#/admin/sales_order/#]]></from>
        <to>/emadmin/adminhtml_sales_order/</to>
    </em_emadmin_adminhtml_sales_order>
    </rewrite>

    <blocks>
        <adminhtml>
            <rewrite>
                <sales_order_grid>EM_DeleteOrder_Block_Adminhtml_Sales_Order_Grid</sales_order_grid>
            </rewrite>
        </adminhtml>
    </blocks>       
</global>
<admin>
    <routers>
        <em_deleteorder>
            <use>admin</use>
            <args>
                <module>EM_DeleteOrder</module>
                <frontName>emadmin</frontName>
            </args>
        </em_deleteorder>           
        <adminhtml>
            <args>
              <modules>
                <EM_DeleteOrder_Adminhtml before="Mage_Adminhtml">EM_DeleteOrder_Adminhtml</EM_DeleteOrder_Adminhtml>
              </modules>
            </args>
        </adminhtml>
    </routers>
</admin>
</config>

1 Answer 1

1

Try removing this:

<em_emadmin_adminhtml_sales_order>
    <from><![CDATA[#/admin/sales_order/#]]></from>
    <to>/emadmin/adminhtml_sales_order/</to>
</em_emadmin_adminhtml_sales_order>

That way of rewriting controllers is very dangerous.

For moduleB change this:

<modules>
    <ModuleB_AdminhtmlControllers before="EM_DeleteOrder">ModuleB_AdminhtmlControllers</ModuleB_AdminhtmlControllers>
</modules>

To

<modules>
    <ModuleB_AdminhtmlControllers before="EM_DeleteOrder_Adminhtml">ModuleB_AdminhtmlControllers</ModuleB_AdminhtmlControllers>
</modules>

The value for before must be the module key you are trying to rewrite. (in this case EM_DeleteOrder_Adminhtml)

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.