Guest Posted October 14, 2013 Posted October 14, 2013 I have just added osCommerce to an existing website, so all the products are "new" to osCommerce; as a result New Products for (Current Month) shows all the products just added. So far, no surprise, but this is obviously not what I want, I need only the real new products for (Current Month). I thought that I could achieve this by just changing the date added (and possibly also the date modified) to an earlier date by manually editing the database products table, but this has no effect. I can achieve what I want empirically by simply setting the maximum number of the new items to the number of the real new items, but do I really have to do this? I know it isn't difficult, but I want the client to do his own maintenance of the catalog and I would like to minimise the number of changes he has to make. I'm probably missing something obvious, so any help would be much appreciated.
Bob Terveuren Posted October 14, 2013 Posted October 14, 2013 Hi there I'm looking at the code for the file products_new.php that goes with osC 2.3.3.2 (not sure if it's changed for the version you have there or if we're even talking about the same file....) Anyways - he's got this line of code to select the products to show $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"; So it's just going to display all the products arranged by date added descending (and then split them into pages according to the new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW); Kind of a bluff really - you can 'pretend' that you have new products even when you have not added anything for years ;-) So if we are talking about the same file then you'll need to edit that sql query
Guest Posted October 14, 2013 Posted October 14, 2013 Hi, Thanks for that. Yes, I see the line you refer to and I suppose I need a "where products_date_added is after end of last month" clause in the query. I might try it, but in the meantime just editing the maximum number shown to the actual number of items I want to show seems a lot easier. The bluff is OK for a new user of the site, but if I were a regular user I think I would take a rather jaundiced view if I kept seeing the same old "new" items all the time!
♥joli1811 Posted October 14, 2013 Posted October 14, 2013 Hi Iain, why not use the featured products contribution this way the client can choose which products to display on the frontpage Regards Joli To improve is to change; to be perfect is to change often.
burt Posted October 15, 2013 Posted October 15, 2013 Note that the code in that thread posted by Spooks is crap, idea is good, code is terrible. Go for this to have the products shown in the last 30 days; http://www.oscommerce.com/forums/topic/347085-setting-the-number-of-products-or-new-products-displayed-limiting-age-of-new-products-shown/#entry1449318 Or this to have products shown added after the start of the month we're in; http://www.oscommerce.com/forums/topic/347085-setting-the-number-of-products-or-new-products-displayed-limiting-age-of-new-products-shown/#entry1449431
Guest Posted October 15, 2013 Posted October 15, 2013 Joli and Burt, Many thanks for your suggestions. I've had a quick look at the Featured Products contribution and, on the face of it, it looks ideal. I might have a go at changing the code, but I must admit I got a bit lost when reading all the discussion! Regards, Iain
Recommended Posts
Archived
This topic is now archived and is closed to further replies.