Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

first 5 random products based on today's date


kkhipple

Recommended Posts

What I would like to do is to run a query that gets the top 4 products based on todays' date... and from that set of 4, randomly picks one to display

 

basically i have a page with a table. 2 rows 2 cols. translates to four boxes = four products on the homepage.

 

i'd like it so that the query does as listed above... and if the user does decide to go back later that day, they still sees the same products... however if they come back ot the site the next day, it shwos different products which are visible on the page until the next day.. and so on..

 

 

can anyone help me with my quest? anyone?

 

 

 

Currently I'm using the following query and code:

 

if ($random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status='1' ORDER BY rand()")) {

$random_product['products_name'] = tep_get_products_name($random_product['products_id']);

$random_product['specials_new_products_price'] = tep_get_products_special_price($random_product['products_id']);

 

$info_box_contents = array();

$info_box_contents[] = array();

new infoBoxHeading($info_box_contents);

 

if ($random_product['specials_new_products_price']) {

$rprod_price = '' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '<br>';

$rprod_price .= '<span >' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>';

} else {

$rprod_price = $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id']));

}

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...