Magento limit results in collection

In this post, I will show you how to limit the collection of a Model in Magento. I will use catalog product module for this example.

First, you can use setPageSize() method for setting number of items you want to display in one page.

Mage::getModel('catalog/product')->getCollection()
   ->setPageSize(10);

The second example is to display 10 items from a 5th item

$start = 5;
$limit = 10;
$collection = Mage::getModel('catalog/product')->getCollection();
$collection->getSelect()
   ->limit($limit,$start);
Comments