Zen Cart Logo
Forums / Basic Configuration / why is there no maximum value setting for new products?

why is there no maximum value setting for new products?

Locked

Views: 913

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
4 Dec 2009, 3:42 PM
#1
fiberphile avatar

fiberphile

New Zenner

Join Date:
Oct 2009
Posts:
11
Plugin Contributions:
0

why is there no maximum value setting for new products?

I want my site to display only three of my newest products on the main page of my site but I cannot find a setting for this. It is there for featured products but not new. Why?

I'd rather not have to manually make my new products featured just to be able to limit the number shown on my main page.

4 Dec 2009, 4:25 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: why is there no maximum value setting for new products?

That's rather odd... I guess the idea was that you would want to show all the products that fell under the "new" range. Since there is no admin setting, you could modify the code to make your desired maximum.
In /includes/modules/your_template/new_products.php, find this around line 56:```php
$num_products_count = ($new_products_query == '') ? 0 : $new_products->RecordCount();

// show only when 1 or more


if($num_products_count > 3) $num_products_count = 3;//2009-12-04
```php
$num_products_count = ($new_products_query == '') ? 0 : $new_products->RecordCount();
if($num_products_count > 3) $num_products_count = 3;//2009-12-04
// show only when 1 or more
4 Dec 2009, 4:34 PM
#3
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: why is there no maximum value setting for new products?

The above will only set the column width; to limit the display, you need another addition. Find this around line 73:```php
$col ++;


if($col == ($num_products_count - 1) break;//2009-12-04
```php
$col ++;
if($col == ($num_products_count - 1)) break;//2009-12-04

Note: this will only work if you have only one row of products displayed. If you have more rows, $col will never get high enough to trigger the break and all new products will display. More code will be needed for that case.

4 Dec 2009, 4:45 PM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: why is there no maximum value setting for new products?

This should account for the total number of products displayed so far in cutting off the output:```php
$col ++;
if($col == $num_products_count or ($row * SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS + $col == $num_products_count)) break;//2009-12-04

Only needed if you want more than one row of new products.

Edit - $col has been incremented already, so the "-1" is not needed for any of these.```php
$col ++;
if($col == $num_products_count) break;//2009-12-04