Guest Posted July 24, 2003 Share Posted July 24, 2003 If you do not add new products frequently, the "New products in.." box will look silly after a few mounths, showing the same products all the time. This Mod solves this problem by adding a time for the new items to be displayed in the box. You can easily change the number of days new products are be shown in the box. If there are no new products within the chosen number of days, (default 30) the box will not show up at all. This applies to the box showing under the subcategories aswell. It is very easy to install and to configure. (Contri only contains one file) Please give me feedback on this Mod as it is my first Mod ever. :) Send feedback by PM, mail or by replying to this post, please. The Contribution can be found here: http://www.oscommerce.com/community/contributions,1382 Enjoy! / Henrik (Zipper) Quote Link to comment Share on other sites More sharing options...
Guest Posted July 26, 2003 Share Posted July 26, 2003 I have released a 2,0 of this script with some bugfixes and a major addition. The script now lets you choose if you want to show the box or not when there are no new products within the choosen amount of days. If you choose to show the box, the box will show a text saying No new products this month. This can ofcourse be changed to what ever language you are using on your site. Enjoy! http://www.oscommerce.com/community/contributions,1382 / Henrik (Zipper) Quote Link to comment Share on other sites More sharing options...
chfields Posted July 26, 2003 Share Posted July 26, 2003 I have my box set up so it randomly shows all my products Quote Link to comment Share on other sites More sharing options...
Guest Posted August 10, 2003 Share Posted August 10, 2003 Please help me see if my mod works with MS1 and MS2. Just install it, there is just one file to replace, and give me feedback if it works or not. I have only tested this mod on my own catalog system wich is prior to MS1. Thanks for the help with this. Here?s the mod. http://www.oscommerce.com/community/contributions,1382 / Zipper Quote Link to comment Share on other sites More sharing options...
michael23 Posted November 5, 2004 Share Posted November 5, 2004 Hi, this mod is pretty helpful. But, as always with the many possible varieties of modifications, there is a problem. I use the enable_disable_categories contrib. The modification is made in new_products.php as well. With a lot of comparing code I got it working that far that your mod does it's work properly. But, how else should it be, the categories can't be turned off any more. Here is the code that needs to be changed: That is done 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' and products_date_added > SUBDATE( now( ) , INTERVAL " . $days . " DAY ) 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 = '" . $new_products_category_id . "' and p.products_status = '1' and products_date_added > SUBDATE( now( ) , INTERVAL " . $days . " DAY )"); $check_products_query = tep_db_query("select count(p.products_id) as count 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 = '" . $new_products_category_id . "' and p.products_status = '1' and products_date_added > SUBDATE( now( ) , INTERVAL " . $days . " DAY ) limit " . MAX_DISPLAY_NEW_PRODUCTS); } and that follows after it 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, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where c.categories_status='1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and 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 c.categories_status='1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . $new_products_category_id . "' and p.products_status = '1' order by p.products_date_added DESC limit " . MAX_DISPLAY_NEW_PRODUCTS); } I am stuck!!! Any advise? Thanks a lot in adevance Michael Quote Not because it is difficult we don't dare to do it, but because we don't dare to do it, it is difficult. (Seneca) Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.