I need to customize a Model in a third party extension.

I need to override the Model so I would not be editing the source files. I would also like if in case there is an error for whatever reason coming from my Model, it could be easily disabled by someone with no programming skills.

I had the idea of, perhaps, somehow putting my edited Model in my custom module, declaring it to be used instead of the default one, but if I disable my custom module (containing the Model) from the Admin panel, the default Model would be used.

Is this possible? And if not: What is the preferred way of overriding a third party Model?

  • check this ifconfig is not available for config.xml else it would be easy to rewrite your model conditionally by just xml. – Minesh Patel May 9 '17 at 12:18

You can check in admin config section if your module is disabled. If it's disabled return value of rewritten method.

class Your_Module_Model_Xyz extends Another_Module_Model_Xyz
    public function methodYouWantToRewrite()
        if (!Mage::getStoreConfigFlag('your/config/path')) {
            return parent::methodYouWantToRewrite();

        // You code ...

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.