Magento: How to override/rewrite model class in Magento

Magento: How to override/rewrite model class in Magento
Magento: How to override/rewrite model class in Magento

In many cases we need to extend a Magento core functionality.
What should be the best way to do this? We could just copy the core model class file to the local directory from core. This could be the easiest way, but far from the best.
The cleaner way would be to override/rewrite a core module class.
How to do that? Well, bellow we will present an example.

Override the sales order model (Mage_Sales_Model_Order class):
(more…)

Continue ReadingMagento: How to override/rewrite model class in Magento

Magento: Getting product attributes values and labels

I have found that it is very useful to be able to get attributes from the system and use them in places other than a products category page. I always forget the exact syntax to use so, this is going to be my unofficial cheat sheet.

This is how to get a drop down lists options. I don’t think it will work for a mulit-select attribute. I stick the value/label pairs into an array to use how I please.
(more…)

Continue ReadingMagento: Getting product attributes values and labels