I'm trying to override the core Magento class Mage_Payment_Model_Info in order to solve an error.
To be clear, the override I am talking about has been entirely written by me, and is extending a core Magento model class. The override is not showing up in the stack trace generated by the error, the core version is. A list of solutions I have tried so far is as follows. None have been fully successful.
- Successfully able to override a block that is also part of this process and that override appears in the stack trace.
- Checked for any conflicts. I found some but when I changed my override extends so it extends from the potential conflict class it has no effect.
- Made the code in my override very similar to the original so I know it is not a result of the code I have changed.
Added log statements to both my override and the original so I can confirm which version is being run. The code for the override is as follows:
class Work_Rewrites_Model_Payment_Info extends Mage_Payment_Model_Info { public function getMethodInstance() { Mage::log("In rewrite payment info model"); if (!$this->hasMethodInstance()) { if ($this->getMethod()) { $instance = Mage::helper('payment')->getMethodInstance($this->getMethod()); if ($instance) { $instance->setInfoInstance($this); $this->setMethodInstance($instance); return $instance; } } //return false; Mage::throwException(Mage::helper('payment')->__('The requested Payment Method is not available.')); } return $this->_getData('method_instance'); } }
Revlevant code from the config file is as follows:
<config>
<global>
<models>
<rewrites>
<class>Work_Rewrites_Model</class>
</rewrites>
<payment>
<rewrite>
<info>Work_Rewrites_Model_Payment_Info</info>
</rewrite>
</payment>
<models>
<global>
<config>
Thanks for your help