Take the 2-minute tour ×
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It's 100% free, no registration required.

i want rewrite magento helper core class Mage_Core_Helper_Data. I have try below code, but it is not working

<?xml version="1.0" ?>
<config>
    <global>
            ...
        <helpers>
            <csscompresser>
                <class>Amit_CssCompresser_Helper</class>
            </csscompresser>
            <core>
                <rewrite>
                    <data>Amit_CssCompresser_Helper_Core_Data</data>
                </rewrite>
            </core>
        </helpers>
        ...
    </global>
<config>

Can any one tell why is not working?

share|improve this question

1 Answer 1

up vote 6 down vote accepted

When you rewrite a helper class, it will only take effect when you use Mage::helper('...').

However, most helper classes extend from Mage_Core_Helper_Data directly and then, the original class is used :(

For example: class My_Custom_Helper_Class extends Mage_Core_Helper_Data { }

If you want to rewrite such a class in all cases, you can use the ugly method to copy it into app/code/local/Mage/Core/Helper/Data.php and do your edits there.

It is not nice style, but if you want to extend a class very high up in the hierarchy, you have no other choice as far as I know.

share|improve this answer

protected by Amit Bera Nov 21 at 12:25

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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