문제

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

도움이 되었습니까?

해결책

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).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top