Limiting the number of objects in the boxes

Limiting the number of objects in the boxes

Postby chaiavi » Thu May 27, 2010 5:04 pm

How can I limit the number of products on the various boxes like "bestseller" box etc.



Thanks,
Avi.
chaiavi

 
Posts: 122
Joined: Sun May 09, 2010 12:49 pm

Re: Limiting the number of objects in the boxes

Postby admin » Tue Jun 01, 2010 8:20 am

Hi, to limit these products to a specific number you would do the following:

open sidebar-left.tpl and find the section for the box you want to limit. In this example I will limit Bestsellers to only 5 products instead of the default 10.

find the line:

Code: Select all
<?php foreach($this->top_sellers as $top): ?>


replace this with:

Code: Select all
<?php
$limit = 5;
foreach ($this->top_sellers as $key => $top):
    if($key == $limit) {
        break;
    }
?>
User avatar
admin
Site Admin
 
Posts: 462
Joined: Sun Nov 22, 2009 7:24 pm

Re: Limiting the number of objects in the boxes

Postby chaiavi » Tue Jun 01, 2010 8:25 am

Thanks,

I suggest you add it permanently to your tpl code, rename $limit to $bestSellersLimit and put it at the head of the tpl file.



Anyway, thanks,
Avi.
chaiavi

 
Posts: 122
Joined: Sun May 09, 2010 12:49 pm

Re: Limiting the number of objects in the boxes

Postby admin » Tue Jun 01, 2010 12:24 pm

I'll add some new fields in the admin area for each box type so you can easily limit them from there.
User avatar
admin
Site Admin
 
Posts: 462
Joined: Sun Nov 22, 2009 7:24 pm


Return to Help & Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron