2026 Executive BenchmarkMid-Market Enterprise Modernization: How leaders across unify Commerce, Odoo ERP & AI in 90 days.
MAGENTO COMMERCE

Set limit on Magento Collection

Where $limit will be the number of results we want, $starting_from will be the index of the result set to be considered as starting point (note is the index of first row) -this wil...

Akshar Group Technologies
Dec 25, 2020
1 min read
Verified Source

Where $limit will be the number of results we want, $starting_from will be the index of the result set to be considered as starting point (note is the index of first row) -this will output 5 records starting from 3rd record.

php
<?php
getCollection()->setOrder('name', 'asc'); //getting the product collection, results are ordered by product name
$product_collection->getSelect()->limit($limit,$starting_from);
foreach($product_collection as $_product)
{
echo $_product->getName().'';
}
?>
is the index of first row) -this will ouptput 5 records starting from 3rd record,
getCollection()->setOrder('name', 'asc'); //getting the product collection, results are ordered by product name
$product_collection->getSelect()->limit($limit,$starting_from);
foreach($product_collection as $_product)
{
echo $_product->getName().'';
}
?>
Share this playbook
LET'S BUILD WHAT'S NEXT

What's Holding Your Business Back?

Tell us where you want to go, what's getting in the way, and we'll help you figure out the technology to get there.

No sales pitch. Confidential strategic advisory.