Monday, September 5, 2011

Rewrite Magento Mage_Core_Model_App class?

We cant rewrite "Mage_Core_Model_App" class. Only classes that are instantiated using Mage::getModel('module/model') can be overloaded.

Mage_Core_Model_App is instantiated as a regular PHP class ($app = new Mage_Core_Model_App), because it is one of the first classes instantiated, before Magento configuration is available.

So, the only way to have custom Mage_Core_Model_App is the regular PHP way of doing it, meaning copying it to app/code/local/Mage/Core/Model/App.php and let include_path do its work.

No comments:

Post a Comment