I have a product with 3 attributes(color,size,brand) and some other attributes.

I need to display above 3 attributes in a table with unique rows.

For example product1 values: green,12,samsung

product2 values :yellow,12,samsung

product3 vaules:green,12,samsung.

So I need to get only (product1 or product3 ) & product2 from collection.

(because product1 & product3 all values are same.So i want to avoid duplicate rows)

and my sample code:


How to write query to get above one. Can any one help this ? Thanks in advance.


2 Answers 2


Using this resource you can see that the method ->addAttributeToFilter(AttributeCode, Value) is what you need to apply to a collection to filter products.

So something along these lines should work for you:

    ->addAttributeToFilter('brand', array('eq'=>'samsung'))
    ->addAttributeToFilter('size', array('eq'=>'12'))

Depending on your setup you may need to find the ID of those values instead of the text that the customer sees. Also it still may not help you get just the two you are looking for since they have other fields or attributes that make them unique.


You could try with:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.