Get all product collection with the below code:
$collection = Mage::getModel('catalog/product')->getCollection(); $collection->addAttributeToSelect('*');
Add different types of filters on collection. example shown below
// Equal To (eq) $collection->addAttributeToFilter('status', array('eq' => 1)); // Not Equal To (neq) $collection->addAttributeToFilter('visibility', array('neq' => 1)); // Greater Than (gt) $collection->addAttributeToFilter('price', array('gt' => 3.99)); // Less Than (lt) $collection->addAttributeToFilter('price', array('lt' => 3.99)); // Greater Than or Equal To (gteq) $collection->addAttributeToFilter('price', array('gteq' => 4.99)); // Less Than or Equal To (lteq) $collection->addAttributeToFilter('price', array('lteq' => 4.99)); // Contains (like) - also uses % wildcards $collection->addAttributeToFilter('sku', array('like' => 'DVD%')); // Does Not Contain (nlike) - also uses % wildcards $collection->addAttributeToFilter('sku', array('nlike' => 'ABC%')); // In Array (in) $collection->addAttributeToFilter('id', array('in' => array(1,3,12))); // Not In Array (nin) $collection->addAttributeToFilter('id', array('nin' => array(1,2,12))); // Is NULL (null) $collection->addAttributeToFilter('description', 'null'); // Is Not NULL (notnull) $collection->addAttributeToFilter('description', 'notnull');