Magento addAttributeToFilter() and addAttributeToSelect()
Feb 25, 2012 · 1 minute readCategory: magento
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 would be returned for a collection of entities.
A combination of these two functions could be likened to sql
SELECT 'some_attribute2' FROM Table WHERE 'some_attribute1'='attribute_value'