Tuesday, October 13, 2015

Magento - model rewrite/override not working

Your model overwrite seems to be ignored?

Please perform another careful inspection of your module's config.xml.

EXAMPLE (in config.xml , rewrite section)

This is not OK:

This is OK:

Magento uses all whitespaces in new block name, and it cannot find the file with extra whitespaces!

This is pretty hard to debug, but you can confirm it with this call:

$creditmemoItem = Mage::getModel('sales/order_creditmemo_item');
 echo "A=".get_class($creditmemoItem);

If you have rewritten this class correctly, it should print out Gogi_Cmsubtotals_Model_Creditmemo_Item. If not, it will printout just thi:

Also, you need to either refresh or (better) disable the cache to see the changes online!!!

I hope this tip can save you from some trouble!

No comments:

Post a Comment

Ubuntu 12.04, 14.04, 16.04 - auto start an app or script before login

To run a command or application at startup, even before the user has logged in, you can use this file: /etc/rc.local The commands entered...