Guest Posted September 4, 2008 Posted September 4, 2008 I've noticed on my Newest Arrivals page that my whole inventory is listed. How can I keep the list down to a managable level. It's showing 2611 products! Any feedback appreciated.
Guest Posted September 4, 2008 Posted September 4, 2008 In includes/modules/new_products.php find: if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { $new_products_query = tep_db_query("select p.products_date_added, 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 TO_DAYS(NOW()) - TO_DAYS(p.products_date_added) < ".$days_of_new_products." order by rand() desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } else { $new_products_query = tep_db_query("select distinct p.products_date_added, 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' AND TO_DAYS(NOW()) - TO_DAYS(p.products_date_added) < ".$days_of_new_products." order by rand() desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } add before: $days_of_new_products = ***SET YOUR NUMBER OF DAYS***; $unix_days_of_new_products = $days_of_new_products * 86400;
Guest Posted September 4, 2008 Posted September 4, 2008 In includes/modules/new_products.php find: if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { $new_products_query = tep_db_query("select p.products_date_added, 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 TO_DAYS(NOW()) - TO_DAYS(p.products_date_added) < ".$days_of_new_products." order by rand() desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } else { $new_products_query = tep_db_query("select distinct p.products_date_added, 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' AND TO_DAYS(NOW()) - TO_DAYS(p.products_date_added) < ".$days_of_new_products." order by rand() desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } add before: $days_of_new_products = ***SET YOUR NUMBER OF DAYS***; $unix_days_of_new_products = $days_of_new_products * 86400; Thanks so much!
Guest Posted September 5, 2008 Posted September 5, 2008 Well, that didn't seem to have any effect. Its still listing my whole inventory. Any other ideas?
Guest Posted September 5, 2008 Posted September 5, 2008 Can you post in that portion of your new_products.php
lindsayanng Posted September 5, 2008 Posted September 5, 2008 did you add ALL of your new products on the same day?? or are ones that you KNOW were added on different days still showing/ A great place for newbies to start Road Map to oscommerce File Structure DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways! HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you Proud Memeber of the CODE BREAKERS CLUB!!
Guest Posted September 5, 2008 Posted September 5, 2008 did you add ALL of your new products on the same day?? or are ones that you KNOW were added on different days still showing/ Well, it took me over 6 weeks to add 2,000 products. I'm kinda slow that way ;) It's showing the the most recent first and dating them right, that's not the problem.
Guest Posted September 5, 2008 Posted September 5, 2008 Can you post in that portion of your new_products.php new contentBoxHeading($info_box_contents); $days_of_new_products = 30; $unix_days_of_new_products = $days_of_new_products **86400; if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { $new_products_query = tep_db_query("select p.products_featured, p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, 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_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_featured DESC, 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, pd.products_name, 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_DESCRIPTION . " pd, " . 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' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } I so don't do code! Thank you for your help...
Guest Posted September 5, 2008 Posted September 5, 2008 I just saw this piece in the code, wouldn't this have something to do with it (although it doesn't seem to since it isn't working for me) $date = strtotime("-60 days"); // set max age of displayed product $date = strftime("%Y-%m-%d",$date); $grid = strstr(PRODUCT_THUMBNAIL_VIEW, 'grid'); $style = (!$grid ? 'class="smallText"' : 'class="infoBoxGrid"'); $border = (!$grid ? '<table class="infoBoxProducts" cellpadding="4" width="'.PRODUCT_LIST_WIDTH.'" height="'.PRODUCT_LIST_HEIGHT.'"><tr><td>' : '<br>'); $borderend = (!$grid ? '</td></tr></table>' : ''); $column_list = array('PRODUCT_LIST_IMAGE', 'PRODUCT_LIST_NAME' , 'PRODUCT_LIST_PRICE' );
germ Posted September 5, 2008 Posted September 5, 2008 $unix_days_of_new_products = $days_of_new_products **86400; One too many asteriks there... $unix_days_of_new_products = $days_of_new_products * 86400; Can't say if that's the only problem... :blush: If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
Guest Posted September 5, 2008 Posted September 5, 2008 $unix_days_of_new_products = $days_of_new_products **86400; One too many asteriks there... $unix_days_of_new_products = $days_of_new_products * 86400; Can't say if that's the only problem... :blush: Thanks Jim!
germ Posted September 6, 2008 Posted September 6, 2008 I think I cracked this nut, Deb! :lol: In your products_new.php find this code: $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"; $products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW); Replace it with: $mdy = strftime(DATE_FORMAT_SHORT, time() - (30 * 24 * 60 * 60) ); $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 . "' and p.products_date_added >= '" . tep_date_raw($mdy) . "'" . " order by p.products_date_added DESC, pd.products_name"; $products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW); This would limit it to products added in the last 30 days. To shorten or lengthen that time replace the number 30 in this formula: $mdy = strftime(DATE_FORMAT_SHORT, time() - (30 * 24 * 60 * 60) ); At least this seemed to work on my site. Of course you should make a backup of the file before making any edits. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
Guest Posted September 6, 2008 Posted September 6, 2008 It worked! It worked!!!!! Thanks so much Jim!!!!
Guest Posted February 7, 2009 Posted February 7, 2009 I am unable to get this code to work. I think it is because tep_date_raw($mdy) is in yyyyddmm format but my products_date_added is in yyyymmdd any one have any suggestions? Scott
germ Posted February 7, 2009 Posted February 7, 2009 $mdy = strftime("%m/%d/%Y", time() - (30 * 24 * 60 * 60) ); If that doesn't work I don't know what to say 'cuz it works for me.... :blush: If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
Guest Posted February 7, 2009 Posted February 7, 2009 $mdy = strftime("%m/%d/%Y", time() - (30 * 24 * 60 * 60) ); If that doesn't work I don't know what to say 'cuz it works for me.... :blush: Thats it! Perfect, For anyone interested I also found http://addons.oscommerce.com/info/3030 but its got more than i need so i'm going to run with your way. Thanks for your help. Scott
burt Posted February 7, 2009 Posted February 7, 2009 $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, 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_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' AND p.products_date_added > date_sub(NOW( ), INTERVAL 1 MONTH) order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); http://www.clubosc.com/make-the-new-produc...ore-useful.html
germ Posted February 7, 2009 Posted February 7, 2009 Nice. You really should update the header on your site. It's not entirely accurate. Last time I looked you were number 13. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
burt Posted February 7, 2009 Posted February 7, 2009 LOL. Only 3000 more posts of crap to catch up ;)
jhande Posted February 7, 2009 Posted February 7, 2009 I think I cracked this nut, Deb! :lol: In your products_new.php find this code: $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"; $products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW); Replace it with: $mdy = strftime(DATE_FORMAT_SHORT, time() - (30 * 24 * 60 * 60) ); $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 . "' and p.products_date_added >= '" . tep_date_raw($mdy) . "'" . " order by p.products_date_added DESC, pd.products_name"; $products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW); This would limit it to products added in the last 30 days. To shorten or lengthen that time replace the number 30 in this formula: $mdy = strftime(DATE_FORMAT_SHORT, time() - (30 * 24 * 60 * 60) ); At least this seemed to work on my site. Of course you should make a backup of the file before making any edits. Is this the only edit needed or do we also have to make the edit Rebecca Call suggested in Post #2? - :: Jim :: - - My Toolbox ~ Adobe Web Bundle, XAMPP & WinMerge | Install ~ osC v2.3.3.4 -
germ Posted February 7, 2009 Posted February 7, 2009 I only made one edit to get it to work. :) If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
jhande Posted February 7, 2009 Posted February 7, 2009 Thanks Jim! My bad, I should have looked closer at the code and what files to edit. :blush: Got it working just great, thanks Jim and Rebecca. ;) Now I'm off to edit the layout and theme. Hopefully I can get it to resemble the product listing table. :huh: - :: Jim :: - - My Toolbox ~ Adobe Web Bundle, XAMPP & WinMerge | Install ~ osC v2.3.3.4 -
Recommended Posts
Archived
This topic is now archived and is closed to further replies.