0

I'm trying to extend the review block helper located at /app/code/core/core/Mage/Review/Block/Helper.php. I've created a new module at /app/code/local/MyModule/Review/Block/Helper.php which includes and extends the parent class as follows:

include('Mage/Review/Block/Helper.php');

class Mymodule_Review_Block_Helper extends Mage_Review_Block_Helper
{

I've also created a config.xml file at app/code/local/Mymodule/etc/config.xml which contains the following:

<?xml version="1.0"?>
<config>
    <modules>
       <Mymodule>
            <version&gt;1.0.1</version>
       <;/Mymodule>
   </modules>
   <global>
      <blocks>
       <review>
         <rewrite>
           <mage_review_block_helper>Mymodule_Review_Block_Helper</mage_review_block_helper>
         </rewrite>
        </review>
      </blocks>
   </global>
</config>

However, any method changes that I drop into my file I not being implemented on the front end, with or without flushing the cache.

I suspect it's something as simple as the keys in the XML not being correct but I can't work out what that correct nesting should be.

Any help would be appreciated.

Thanks

2 Answers 2

3

Your config.xml should look like this:

<?xml version="1.0"?>
<config>
    <modules>
       <Mymodule>
            <version>1.0.1</version>
       </Mymodule>
   </modules>
   <global>
      <blocks>
       <review>
         <rewrite>
           <helper>Mymodule_Review_Block_Helper</helper>
         </rewrite>
        </review>
      </blocks>
   </global>
</config>

and you can remove include('Mage/Review/Block/Helper.php'); from your class file. It will be autoloaded when needed.

1
  • Thanks, bit of a noob with this Magento lark. Great help! Jan 27, 2015 at 12:38
2

there are lot of issue in your module

1.for block type rewrite ,you donot need to add Parent class in include path.

include('Mage/Review/Block/Helper.php'); Just remove it

2.Rewrite code is wrong.

<mage_review_block_helper>Mymodule_Review_Block_Helper</mage_review_block_helper>

should be

<helper>Mymodule_Review_Block_Helper</helper>

3.Your module declarationn in config.xml wrong:

 <modules>
       <Mymodule>
            <version&gt;1.0.1</version>
       <;/Mymodule>
   </modules>

should be

<modules>
       <Mymodule_Review>
            <version>1.0.1</version>
       </Mymodule_Review>
   </modules>

Your Answer

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

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