1

I'm trying to override a function in Mage_CatalogRule_Model_Rule but I can't get it to work.

config.xml

<config>
    <global>
        <models>
            <rule>
                <rewrite>
                    <rule>Apptha_Timer_Model_CatalogRule_Model_Rule</rule>
                </rewrite>
            </rule>
        </models>
    </global>
</config>

/app/code/local/Apptha/Timer/Model/CatalogRule/Model/Rule.php

class Apptha_Timer_Model_CatalogRule_Model_Rule extends Mage_CatalogRule_Model_Rule {
    protected function _convertFlatToRecursive(array $data) {
        //not called
    }
}

What am I missing? I've been able to override controllers and blocks just fine.

1 Answer 1

4
<global>
    <models>
        <catalogrule>
            <rewrite>
                <rule>Apptha_Timer_Model_CatalogRule_Model_Rule</rule>
            </rewrite>
        </catalogrule>
    </models>
</global>

The node of models need to be the namespace of the module. If you instantiate the rule with Mage::getModel('catalogrule/rule') this needs to be catalogrule

This namespace can be found here:

/app/code/core/Mage/CatalogRule/etc/config.xml

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.