开发者

Filter collection by attribute Set

开发者 https://www.devze.com 2022-12-22 23:41 出处:网络
How would one filter collection by attribute set name I am trying as following, but its not working $collection->addAttributeToFilter(\'attribute_set_name\',\"Quantity Television开发者_开发知识库

How would one filter collection by attribute set name

I am trying as following, but its not working

$collection->addAttributeToFilter('attribute_set_name',"Quantity Television开发者_开发知识库 Parts");

Thank You


This is how i end up doing.

I looked up id of the attribute-set-name in the table "eav_attribute_set" table and used following filter:

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


We can filter the collection by attribute set using:

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

suppose your attribute set id is 10.

For example

$collection = Mage::getModel('catalog/product')->getCollection();

$collection->addAttributeToFilter('status', array('eq' =>1))

           ->addAttributeToFilter('attribute_set_id','10')
           ->addAttributeToSelect('*');
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号