1

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?

sv3n
  • 11,657
  • 7
  • 40
  • 73
Metal Mathematician
  • 1,482
  • 3
  • 21
  • 36

1 Answers1

2

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 ...
    }
}
sv3n
  • 11,657
  • 7
  • 40
  • 73