Home » Magento19 March 2012

Magento: Adding OR and AND query condition to collection

Here is a quick tip to add OR query and AND query to collection object. I am implementing this on product collection.

Getting product collection

Adding AND query condition

Filtering collection to select only those products whose sku is like ‘ch’ AND status is equal to 1 (i.e. enabled status).

Adding OR query condition

Filtering collection to select only those products whose sku is like ‘ch’ OR status is equal to 1 (i.e. enabled status).

You may check the query statement with the following code

Thanks.

From Mukesh Chapagain's Blog, post Magento: Adding OR and AND query condition to collection

php magento mukesh chapagain

Get New Post by Email

Find me on

Facebook Twitter Google+ LinkedIn RSS Feed
  • pradeep

    Hi,

    How will we solve this issue “Configurable Product turn Out of Stock when all child product are out of stock”?