Home / Magento


addAttributeToSelect – addAttributeToFilter – addFieldToFilter

What’s the difference between addAttributeToSelect(), addAttributeToFilter() and addFieldToFilter() methods? As you know that a product can have many attributes. The addAttributeToSelect() method is used to select the attributes that we want to retrieve. So this method doesn’t filter out the collections, only the attributes. If we use addAttributeToSelect(‘*’), then all …

Read More »

Magento addAttributeToFilter() and addAttributeToSelect()

These two Magento functions looks more like there is no obvious difference between them, but there is. addAttributeToFilter('some_attribute1','attribute_value') filters a Magento entity collection (e.g Products, categories) by only selecting entities that has ‘some_attribute’ equal to ‘attribute_value’ while addAttributeToSelect('some_attribute2') tells Magento to return add ‘some_attributes’ to the set of properties that …

Read More »

Difference between Mage::getSingleton() and Mage::getModel() in Magento

Mage::getSingleton() Mage::getSingleton() will first check the same class instance is exits or not in memory. If the instance is created then it will return the same object from memory. So Mage::getSingleton() faster then Mage::getModel(). $product1 = Mage::getSingleton('catalog/product'); $product2 = Mage::getSingleton('catalog/product'); $product1 and $product2 both will share same memory of OS …

Read More »

How to create an observer in Magento?

How to create an observer in Magento.? —————————– We are consider that you are familiar to create new module in magento. Following are the steps to create a module in magento to override the observer. Step 1) Create main module xml file We need to create a file called Cmpny_Observername.xml …

Read More »

How we can add one more new option in product images in magento?

You would need to update following files : 1) appcodecoreMageCatalogModelProductAttributeBackendMedia.php 2) appcodecoreMageCatalogModelResourceProductAttributeBackendMedia.php 3) appcodecoreMageCatalogModelProductAttributeMediaApi.php 4) appdesignadminhtmldefaultdefaulttemplatecatalogproducthelpergallery.phtml 5) jsmageadminhtmlproduct.js Also You would need to alter table “catalog_product_entity_media_gallery_value” and Add field in Table ‘newoption’ How we can add one more new option in product images in magento please follow below steps : …

Read More »