Class Overrides

Finally, the Magento System offers you the ability to replace Model, Helper and Block classes from the core 
modules with your own. Here's an example to help you understand. The Model class for a product is 

	$product = Mage::getModel('catalog/product'); 

This is a factory pattern. 

You can change the behavior of any method on the class, but keep the functionality of the existing methods.

	class Packagename_Modulename_Model_Foobazproduct extends Mage_Catalog_Model_Product
	    public function validate()
		//add custom validation functionality here
		return $this;


As you might expect, this overriding (or rewriting) is done in the config.xml file.

	    <!-- tells the system this module has models -->

	    <!-- does the override for catalog/product-->