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.