2

I'm attempting to rewrite protected function _prepareColumns() in Mage_Adminhtml_Block_Catalog_Product_Grid

I have created the class MyCompany_Overrides_Block_Adminhtml_Catalog_Product_Grid, extending Mage_Adminhtml_Block_Catalog_Product_Grid, with the following in the config.xml:

<global>
    <blocks>
         <catalog>
            <rewrite>
                <product_grid>MyCompany_Overrides_Block_Adminhtml_Catalog_Product_Grid</product_grid>
            </rewrite>
        </catalog>
    </blocks>
</global>

However, the rewrite function is not being hit, but instead the original function is hit.

Could anyone point out any obvious flaws in the setup?

2

It's because you're not using the right namespace, it should be adminhtml instead of catalog

<global>
    <blocks>
         <adminhtml>
            <rewrite>
                <catalog_product_grid>MyCompany_Overrides_Block_Adminhtml_Catalog_Product_Grid</catalog_product_grid>
            </rewrite>
        </adminhtml>
    </blocks>
</global>

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.