In my last project I got a requirement from my client to restrict the virtuemart product pages to display total and maximum 6 products in a page by default, then I noticed that under virtuemart 1.1.9 admin there is no option to set the number of products to display on each product page.
Here I got the best solution to achieve the scenario –
Setting default number of product to display on product pages in virtuemart
1. Locate the file in your admin virtuemart folder
/administrator/components/com_virtuemart/classes/pageNavigation.class.php
2. Search for the below code
for ($i=5; $i <= 30; $i+=5)
{
if (empty( $link)) {
$limits[$i] = $i;
} else {
$limits[vmRoute($link.'&limit='.$i)] = $i;
}
}
3. Update the # in the above for loop as per your requirement so -
the 1st value (5) is the smallest # of products shown, or say the very first value going to be display in pagination dropdown
the 2nd value (30) is until which # of products it will count up in steps of the 3rd value (5), so this will be like 5×1=5,5×2=10,5×3=15…..5×6=30.
Go ahead and check your product pages get starting to display number of products as per your choice, and along with that “Display” dropdown under pagination get also filled with new options as per changes and requirement
Your output will look something like this –
