Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Limit "New Products" Pages?


stride128

Recommended Posts

Posted

Hello. Does anyone know how to limit the amount of pages that show up on the "New Products" page? Right now, I have around 120,000 products and around 37,000 pages on the "New Products" page. I want to limit it to around 5 pages. Does anyone know of a contrib that does that?

Posted

You could try this. In catalog/products_new.php find

  $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";

Change to

  $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by rand() limit '50'";

That will give a random selection of products with a limit of 50. Change to 50 to what you need.

Backup your file first

Posted

Thanks for the reply. It didn't seem to work. I got an error on the page. I want everything as is, just limit it to 5 pages.

  • 2 weeks later...
Posted
Hello. Does anyone know how to limit the amount of pages that show up on the "New Products" page? Right now, I have around 120,000 products and around 37,000 pages on the "New Products" page. I want to limit it to around 5 pages. Does anyone know of a contrib that does that?

 

Try this:

in products_new.php, after this code:

if (($products_new_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) {

 

Insert this code:

 $products_new_split->number_of_rows=100;

 

So, this is the full code from rows 61-70:

<?php
 $products_new_array = array();

 $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";
 $products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW);


 if (($products_new_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) {
  $products_new_split->number_of_rows=100;
?>

  • 1 month later...
Posted

this code

$products_new_split->number_of_rows=100;

limits the number of products that being displayed. i want to limit the number of pages.

how can i do that?

 

 

thanks :)

Posted

surely you have a certain number of products per page, so limiting the number of products will limit the number of pages, eg if you want 5 pages max, and have 20 per page, then 100 product limit will limit you to 5 pages.

Posted

yes, i know that :)

but in new products page, shows all the available products in the shop!

i want to limit that number if it's possible

Posted
yes, i know that :)

but in new products page, shows all the available products in the shop!

i want to limit that number if it's possible

 

Login to Admin Control Panel

 

- Configuration

- Look For New Products Listing

- Change the number to 100, 200, 500 or whatever number of products you wish to show in New Products Category.

- Save setting

- Test and update!

Best Regards,
Gaurav

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...