-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Magento PHP Developer????s Guide, 2nd Edition
By :
If you look back at the previous code example, you will notice that I'm not only instantiating a product model, but I'm also calling the getCollection() method. The getCollection() method is part of the Mage_Core_Model_Abstract class, meaning, every single model inside Magento can call this method.
All collections inherit from Varien_Data_Collection.
A Magento collection is basically a model that contains other models. So instead of using an array to hold a collection of products, we will use a product collection. Collections not only provide a convenient data structure to group models, they also provide special methods that we can use to manipulate and work with a collection of entities.
Some of the most useful collection methods are:
addAttributeToSelect: To add an attribute to the entities in a collection; * can be used as a wildcard to add all the available attributesaddFieldToFilter: To add an attribute filter to a collection; this function...
Change the font size
Change margin width
Change background colour