Query in Magento

Magento have own standard of query,

    $products   = $product->setStoreId($storeId)->getCollection()
	->addAttributeToSelect('status')
	->addAttributeToFilter('featured', array('Yes'=>true))
	->addAttributeToSelect(array('name', 'price', 'small_image'), 'inner');

If we want to add the other condition like
for random case,

$products->getSelect()->order(new Zend_Db_Expr('RAND()'));
or
$products->getSelect()->order('rand()');

for to limit

$products->getSelect()->limit(3);
or
$products->setPageSize(5)->setCurPage(1);
%d bloggers like this: