Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Mixing up new items and specials on our homepage.


Guest

Recommended Posts

We just finished entering a bunch of new products in our site. We had done it a catagory at a time and when we finished, all of the items displayed on our homepage in the What's New Box, in the New Products for January Box, and it the Specials Box are all from the same category! We would like this to display a mix of other catagory items that we carry. Is there a way to select what dislpays in these boxes? If so, how is it done?

Link to comment
Share on other sites

We just finished entering a bunch of new products in our site. We had done it a catagory at a time and when we finished, all of the items displayed on our homepage in the What's New Box, in the New Products for January Box, and it the Specials Box are all from the same category! We would like this to display a mix of other catagory items that we carry. Is there a way to select what dislpays in these boxes? If so, how is it done?

 

You could try altering the queries that populate these boxes, and give them a date threshhold to query for newer-by, and then order the result set randomly, rather than it being ordered by date... I'm guessing that the category it's showing them for is the last category you added to, which would make those products the most recent... You would just say something like this:

 

$days_old = 7;

$products_query = tep_db_query("select blahblahblah from whatever_tables where existing_where_conditions AND UNIX_TIMESTAMP(products_date_added) >= '" . (time() - ($days_old * 24 * 60 * 60)) . "' order by rand() limit <existing_limit_conditions, i.e. MAX_DISPLAY_NEW_PRODUCTS>");

 

Sorry I don't have the exact syntax to give you, but I'm at work right now and don't have my code readily available to pull that query from, but hope this helps :)

 

Richard.

 

p.s. If you wanted to make it a New Products for <month> box and have them randomly generated, you could just make the query something like this:

 

$products_query = tep_db_query("select blahblahblah from whatever_tables where existing_where_conditions AND UNIX_TIMESTAMP(products_date_added) >= '" . (mktime(0,0,0,date("m"),date("d"),date("Y")) . "' order by rand() limit <existing_limit_conditions, i.e. MAX_DISPLAY_NEW_PRODUCTS>");

 

and that would check for all products newer than midnight on the first of the month, and order the results randomly...

Richard Lindsey

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...