A collection of filters by the attribute Set

Like one collection of filters by the name of an attribute set

I am trying to do the following but its not working

$collection->addAttributeToFilter('attribute_set_name',"Quantity Television Parts"); 

thanks

+4
source share
2 answers

This is how I end up doing.

I searched for the identifier of the set-name attribute in the table "eav_attribute_set" and used the following filter:

 $products->addAttributeToFilter('attribute_set_id','33'); 
+11
source

We can filter a collection by a set of attributes using:

 addAttributeToFilter('attribute_set_id','attribute set id here'); 

suppose your attribute id is 10.

for instance

 $collection = Mage::getModel('catalog/product')->getCollection(); $collection->addAttributeToFilter('status', array('eq' =>1)) ->addAttributeToFilter('attribute_set_id','10') ->addAttributeToSelect('*'); 
+3
source

Source: https://habr.com/ru/post/1303989/


All Articles