Search code examples
magentofilteroptional-parametersgetattribute

How to filter by Attribute set using $this->getAttributes();


I am currently using this code for displaying all attributes.

$attributes = $this->getAttributes();

I want to know how to filter it by Attribute Set, Input type and other attribute options.

Thanks in advance


Solution

  • you can use

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

    here, 33 is your attribute set id.
    for example,

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