0

I wish to rewrite some methods in Mage_Catalog_Block_Product_Compare_List. What do I need to add to config.xml and what should my classname be?

2
  • The class name is technically arbitrary, though if you are following convention then (1) its definition will be autoloaded by the class name, and (2) it will be located in a Block subfolder in your module and therefore the name will begin with Namespace_ModuleName_Block.
    – benmarks
    Feb 17, 2014 at 0:54
  • So, since the name is .._Block_Product_Compare_List I should create a file named list.php in ../Namespace/Modulename/Block/Product/Compare/ and put my class there, is that correct?
    – fuumind
    Feb 17, 2014 at 5:49

1 Answer 1

1

Create block Namespace_Modulename_Block_Product_Compare_List and extend it from Mage_Catalog_Block_Product_Compare_List. Rewrite all methods you need.

Then in config.xml

<config>
    <global>
        ...
        <blocks>
            <catalog>
                <rewrite>
                   <product_compare_list>Namespace_Modulename_Block_Product_Compare_List</product_compare_list>
                </rewrite>
            </catalog>
       </blocks>
        ...
    </global>
</config>

Anyway here you can find more information about rewriting in magento.

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.