Monday , September 25 2023
Home / Magento / Magento addAttributeToFilter() and addAttributeToSelect()

Magento addAttributeToFilter() and addAttributeToSelect()

These two Magento functions looks more like there is no obvious difference between them, but there is.

Select Code

filters a Magento entity collection (e.g Products, categories) by only selecting entities that has ‘some_attribute’ equal to ‘attribute_value’ while

Select Code

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 Code
SELECT 'some_attribute2' FROM Table WHERE 'some_attribute1'='attribute_value'

About v.shakya

I am V.Shakya, Software Developer & Consultant I like to share my ideas, views and knowledge to all of you who come across my website. I am young, enthusiastic, highly motivated and self disciplined person. I completed my studies in Master of Computer Application and currently giving my technical expertise to one of the Big IT company. I have more than fifteen years of experience in vast field of Programming , Designing and Development of websites and various software's.

Check Also

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) …

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.