0

I tried to rewrite the Mage_CatalogRule_Helper_Data.
But somehow my code is not used instead of the original helper.
Can someone please point out the error I have made so I can understand what went wrong, how to do it correct and so I can learn to rewrite more correctly in future.
Btw. as far as I can see the module is activated, so the Test_CatalorRule.xml should be correct.

\app\etc\modules\Test_CatalogRule.xml

<config>
    <modules>
        <Test_CatalogRule>
            <active>true</active>
            <codepool>local</codepool>
        </Test_CatalogRule>
    </modules>
</config>

\app\code\local\Test\CatalogRule\etc\config.xml

<config>
    <modules>
        <Test_CatalogRule>
            <version>1.0.0</version>
        </Test_CatalogRule>
    </modules>
    <global>
        <helpers>
            <catalogrule>
                <rewrite>
                    <data>Test_CatalogRule_Helper_Data</data>
                </rewrite>
            </catalogrule>
        </helpers>
    </global>
</config>

\app\code\local\Test\CatalogRule\Helper\Data.php

class Test_CatalogRule_Helper_Data extends Mage_CatalogRule_Helper_Data
{
    public function calcPriceRule($actionOperator, $ruleAmount, $price)
    {
        return 42;
    }
}

Thanks for any help

1
  • codepool should be with a capital P. Is your extension showing up under System > Configuration > Advanced, i.e. is it properly installed? Commented Sep 16, 2013 at 14:27

1 Answer 1

1

In the declaration file (etc/modules) this is wrong:

<codepool>local</codepool>

It should be with an uppercase P.

<codePool>local</codePool>

This happened a lot to me. Now, when I create a new extension and add a file to etc/modules, I just clone one of the existing files and modify the text, but leave the tags as they are.
Off topic: this happens a lot with the <depends> tags in the same file. In a lot of cases it says <depend> (without the s at the end).

0

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.