Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

how can I make osC display random products instead of new products on the index page?


Yrewol

Recommended Posts

Posted
Anyone????

here's the tips:

 

look for order by ... (say, products_name)

then change it to

order by RAND()

 

Ken

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Posted
how can I make osC display random products instead of new products on the index page?

The contribution Featured Products works well. It allows you to display only the products you specify.

"Outside of a dog, a book is man's best friend.

Inside of a dog, it's too dark to read."

 

GROUCHO (1895-1977)

Posted
here's the tips:

 

look for order by ... (say, products_name)

then change it to

order by RAND()

 

Ken

 

I will give this a try. Where can i find the code you are making refrence to. the file name will suffice.

 

Thank you in advance.

  • 7 months later...
Posted

Thank you Kem your Tip worked for me also, i changed the upmentioned thing in a file include/modules/new_products.php and it's workingggggg yeahhhhh

thanks great tip

Posted
Thank you Kem your Tip worked for me also, i changed the upmentioned thing in a file include/modules/new_products.php and it's workingggggg yeahhhhh

thanks great tip

 

and if someone wants to change the number of the product listed you can edit the same file line 21

the value MAX_DISPLAY_NEW_PRODUCTS to a number of the products you want to be listed on that page

and then find at the end of the file

 

if ($col > 3) {

$col = 0;

$row ++;

 

 

and change >3 to the number of the rows you want +1 (if you want two rows then put number three) at least it worked for me this way ;)

Posted

i find 'order by' in 2 places what do i change? and there is all this after it 'p.products_date_added desc limit' not sure what to change. could you help.

Posted

I have 2 columns and 5 rows that displays 9 products which is obviously an odd number.

 

i would like to display 10 products randomly which is why i came to this thread but my code doesnt make sense to me would anyone be able to put me straight please ?

many thanks in advance - this is taken from catalog\includes\modules\new_products.php

 

if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {

$new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

} else {

$new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

}

 

$row = 0;

$col = 0;

Archived

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

×
×
  • Create New...