0

I'm trying to override a community Adminhtml controller that override already "Mage_Adminhtml"

Community module A with the first override

...
<admin>
 <routers>
  ...
   <adminhtml>
    <args>
     <modules>
      <ModuleA before="Mage_Adminhtml">NameSpaceA_ModuleA_Adminhtml</ModuleA>
     </modules>
    </args>
   </adminhtml>
 </routers>
</admin>
...

I would like to make some changes, so.. Local module B

...
<admin>
 <routers>
  ...
   <adminhtml>
    <args>
     <modules>
      <NameSpaceB_ModuleB before="NameSpaceA_ModuleA_Adminhtml">NameSpaceB_ModuleB_Adminhtml</NameSpaceB_ModuleB>
     </modules>
    </args>
   </adminhtml>
 </routers>
</admin>
...

The local module B depends of module A (<depends> tag), cache is off

The local module B is used, I already override some Adminhtml blocks and models

The local controller is never called, and I tried many things but no results

Thank a lot for any help

apouey
  • 310
  • 1
  • 7

1 Answers1

0

Your local config.xml should be like this:

...
<admin>
 <routers>
  ...
   <adminhtml>
    <args>
     <modules>
      <NameSpaceB_ModuleB before="NameSpaceA_ModuleA">NameSpaceB_ModuleB_Adminhtml</NameSpaceB_ModuleB>
     </modules>
    </args>
   </adminhtml>
 </routers>
</admin>
...

Then you should name your controller class similarly to the extended controller class. Here's an example.

Extended class:

NameSpaceA_ModuleA_Adminhtml_CoolController

Extending class (your controller):

NameSpaceB_ModuleB_Adminhtml_CoolController

Note the "CoolController" part of the class name.

Also, in your NameSpaceB_ModuleB_Adminhtml_CoolController class you have to require the extended class and extend it:

require_once "NameSpaceA/ModuleA/Adminhtml/CoolController.php";

class NameSpaceB_ModuleB_Adminhtml_CoolController 
    extends NameSpaceA_ModuleA_Adminhtml_CoolController {

    /* your code*/

}
ermannob
  • 488
  • 7
  • 16