this could only be possible by having this custom code within extensions/modules/plugins. i don’t see how future magento upgrades could possibly know how to maintain custom changes you’ve made???
All the customizations will be made as separate modules that stored separate, but override existing models, controllers and themes.
So as long as API doesn’t change the customizations will be working while not extended classes and methods will continue being upgraded and provide original functionality.
This process will be outlined when API will be finalized (soon ). If someone is interested in specific technical details of how it will be done, please ask.
As you may have noticed, all the models are referred as Mage::getModel(’module/specific_class’). There are variations such as getSingleton and getResourceModel, but the idea stays the same.
Say you want to extend ‘catalog/product’ model. By default it refers to Mage_Catalog_Model_Product class. Which is declared in Mage/Catalog/etc/config.xml
Our goal is to add a new method getDefaultCategory(). Steps are:
* Create new module Mage_MyCatalog
* class Mage_MyCatalog_Model_Product extends Mage_Catalog_Model_Product
* public function getDefaultCategory()
* create Mage/MyCatalog/etc/config.xml that contains:
Now, all Mage::getModel(’catalog/product’) will create instances of Mage_MyCatalog_Model_Product with my custom method and all the original ones! Still, Mage_Catalog is upgradable.
It is possible to override the whole model group, and same goes for blocks, helpers and controllers.
With themes it’s similar but a bit different. We leave intact the original themes and create new ones for our customizations. When we use them, Magento will take the files that exist in there or fallback to the files in the original themes.