1

I have 2 modules that rewrite the customer account navigation block:

<blocks>
    <customer>
         <rewrite>
              <account_navigation>ModuleA_Block_Navigation</account_navigation>
         </rewrite>
    </customer>
</blocks>

and

<blocks>
  <moduleB>
      <class>ModuleB_Block</class>
  </moduleB>
   <customer>
     <rewrite>
      <account_navigation>ModuleB_Block_Customer_Account_Navigation</account_navigation>
     </rewrite>
   </customer>
</blocks>

And I need to make ModuleA dependent on ModuleB. But I don't really get the logic of the rewrite configuration in this case...

Both classes extend the core class:

class ModuleA_Block_Navigation extends Mage_Customer_Block_Account_Navigation

and

class ModuleB_Block_Customer_Account_Navigation extends Mage_Customer_Block_Account_Navigation

and each has one function, which is with the same name: removeLink() but in ModuleA it is without arguments, and in ModuleB it has 1 argument: removeLink($var).

1

Make ModuleA dependent on ModuleB. In app/etc/modules initialization file:

<?xml version="1.0"?>
<config>
<modules>
    <Namespace_ModuleA>
        <active>true</active>
        <codePool>local</codePool>
        <depends>
            <Namespace_ModuleB/>
        </depends>
    </Namespace_ModuleA>
</modules>
</config>

ModuleB class ModuleB_Block_Customer_Account_Navigation extend from magento's one, but do not use rewrites. ModuleA class ModuleA_Block_Customer_Account_Navigation extend from ModuleB_Block_Customer_Account_Navigation. And in ModileA module's config xml rewrite:

<blocks>
<customer>
     <rewrite>
              <account_navigation>ModuleA_Block_Customer_Account_Navigation</account_navigation>
     </rewrite>
</customer>
</blocks>

This should help.

  • That seems reasonable. But now none of the modules works. – Syspect Jan 27 '14 at 13:54
  • 1
    Are there some errors? – oleksii.svarychevskyi Jan 27 '14 at 13:56
  • Yeah, I checked the exception.log and there was incompatibility between functions in the 2 Block classes. Thanks for that. :) – Syspect Jan 27 '14 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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