Kjolebutikken Posted October 25, 2006 Share Posted October 25, 2006 :) Just a few posts above, the solution to your problem is posted. http://www.oscommerce.com/forums/index.php?s=&...st&p=791883 . -jared Thank you so much Jared and Paul. This worked beautifully for me :-) Quote Best regards Kjolebutikken Link to comment Share on other sites More sharing options...
Optimalkiller Posted March 1, 2007 Share Posted March 1, 2007 Can anyone help me on this one I;m getting this error message when viewing product_listing.php Parse error: parse error, unexpected '.' in C:\Program Files\xampp\htdocs\catalog\includes\modules\product_listing.php on line 110 This is the line in 110 "Product_listing.php" $lc_text = . $img_new_product' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> '; } And this is the function call // added for New Product Icon contribution // 2592000 = 30 days in the unix timestamp format if ( ($today_time - strtotime($listing['products_date_added'])) < 2592000) { $img_new_product = ' ' . tep_image_icon('icon_newarrival.gif', TEXT_ICON_NEW_PRODUCT . ' : ' . $listing['products_name'] ); } // end addition Quote Link to comment Share on other sites More sharing options...
bonbec Posted April 15, 2007 Share Posted April 15, 2007 Hello, There is a mistake here : $lc_text = . $img_new_product' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . The right syntax is : $lc_text = $img_new_product . ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . Quote with OsC 2.2 since 2006 ... Link to comment Share on other sites More sharing options...
Shiyde Posted August 29, 2007 Share Posted August 29, 2007 hello i did put this contrib which is really good but i must have done a mistake somewhere in the setting as i have problem with icons. first, you must know i am on column products so i did update the products_listing.php informations under the products_listing_col.php file. the problem is that the icon shows up on new products ok, but it doesn't show on old products only if on the columns, they are located before the first new product of the list. sorry for my bad english, here i explain better : so on a page where there are no new products, ok no icon appears which is fine on a page where all is new products, ok all have the icon so there is fine as well on a page where all the first ones of the list are old and all the last ones are new, it is fine, icon appear only on the new ones but then, on a page where we have first some old products, then some new products or even 1 new product, and then again some old products, then the problem appear, all the old products which are after the new one(s) are having the icon is there any one who can help me to solve this problem ? thanks a lot ! val Quote Link to comment Share on other sites More sharing options...
Shiyde Posted September 11, 2007 Share Posted September 11, 2007 hello i did put this contrib which is really good but i must have done a mistake somewhere in the setting as i have problem with icons. first, you must know i am on column products so i did update the products_listing.php informations under the products_listing_col.php file. the problem is that the icon shows up on new products ok, but it doesn't show on old products only if on the columns, they are located before the first new product of the list. sorry for my bad english, here i explain better : so on a page where there are no new products, ok no icon appears which is fine on a page where all is new products, ok all have the icon so there is fine as well on a page where all the first ones of the list are old and all the last ones are new, it is fine, icon appear only on the new ones but then, on a page where we have first some old products, then some new products or even 1 new product, and then again some old products, then the problem appear, all the old products which are after the new one(s) are having the icon is there any one who can help me to solve this problem ? thanks a lot ! val no one as any idea how to solve this ? thanks Quote Link to comment Share on other sites More sharing options...
kn-medien Posted January 21, 2008 Share Posted January 21, 2008 Hello, sorry for my English, i am from Germany. I have a Problem with the Contribution. I can see the "NEW-IMAGE" at the "Products new in Januar", but i can dont see it in "New Products", "Search" and "Categories". Any Idea for this Problem? <?php/* $Id: product_listing.php,v 1.39 2002/10/26 22:43:14 dgw_ Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 osCommerce Released under the GNU General Public License*/// added for New Product Icon contribution $today_time = time();// end addition ?><table border="0" width="560" cellspacing="0" cellpadding="2"><?php $listing_numrows_sql = $listing_sql; $listing_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $listing_sql, $listing_numrows);// fix counted products $listing_numrows = tep_db_query($listing_numrows_sql); $listing_numrows = tep_db_num_rows($listing_numrows); if ($listing_numrows > 0 && (PREV_NEXT_BAR_LOCATION == '1' || PREV_NEXT_BAR_LOCATION == '3')) {?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText"> <?php echo $listing_split->display_count($listing_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?> </td> <td align="right" class="smallText"> <?php echo TEXT_RESULT_PAGE; ?> <?php echo $listing_split->display_links($listing_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?> </td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator(); ?></td> </tr><?php }?> <tr> <td><?php $list_box_contents = array(); $list_box_contents[] = array('params' => 'class="productListing-heading"'); $cur_row = sizeof($list_box_contents) - 1; for ($col=0; $col<sizeof($column_list); $col++) { switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $lc_text = TABLE_HEADING_MODEL; $lc_align = 'left'; break; case 'PRODUCT_LIST_NAME': $lc_text = TABLE_HEADING_PRODUCTS; $lc_align = 'left'; break; case 'PRODUCT_LIST_MANUFACTURER': $lc_text = TABLE_HEADING_MANUFACTURER; $lc_align = 'left'; break; case 'PRODUCT_LIST_PRICE': $lc_text = TABLE_HEADING_PRICE; $lc_align = 'left'; break; case 'PRODUCT_LIST_QUANTITY': $lc_text = TABLE_HEADING_QUANTITY; $lc_align = 'right'; break; case 'PRODUCT_LIST_WEIGHT': $lc_text = TABLE_HEADING_WEIGHT; $lc_align = 'right'; break; case 'PRODUCT_LIST_IMAGE': $lc_text = TABLE_HEADING_IMAGE; $lc_align = 'center'; break; case 'PRODUCT_LIST_BUY_NOW': $lc_text = TABLE_HEADING_BUY_NOW; $lc_align = 'center'; break; } if ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW' && $column_list[$col] != 'PRODUCT_LIST_IMAGE') $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text); $list_box_contents[$cur_row][] = array('align' => $lc_align, 'params' => 'class="productListing-heading"', 'text' => " " . $lc_text . " "); } if ($listing_numrows > 0) { $number_of_products = '0'; $listing = tep_db_query($listing_sql); while ($listing_values = tep_db_fetch_array($listing)) { $number_of_products++; if ( ($number_of_products/2) == floor($number_of_products/2) ) { $list_box_contents[] = array('params' => 'class="productListing-even"'); } else { $list_box_contents[] = array('params' => 'class="productListing-odd"'); } $cur_row = sizeof($list_box_contents) - 1; for ($col=0; $col<sizeof($column_list); $col++) { $lc_align = ''; switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $lc_text = ' ' . $listing_values['products_model'] . ' '; break; case 'PRODUCT_LIST_NAME': // added for New Product Icon contribution // 2592000 = 30 days in the unix timestamp format if ( ($today_time - strtotime($listing['products_date_added'])) < 2592000) { $listing['products_name'] .= ' ' . tep_image_button('icon_newarrival.gif', TEXT_ICON_NEW_PRODUCT); } // end addition if ($HTTP_GET_VARS['manufacturers_id']) { $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing_values['products_id'], 'NONSSL') . '">' . $listing_values['products_name'] . '</a>'; } else { $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing_values['products_id']) . '">' . $listing_values['products_name'] . '</a> '; } break; case 'PRODUCT_LIST_MANUFACTURER': $lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing_values['manufacturers_id'], 'NONSSL') . '">' . $listing_values['manufacturers_name'] . '</a> '; break; case 'PRODUCT_LIST_PRICE': $lc_align = 'right'; if ($listing_values['specials_new_products_price']) { $lc_text = ' <s>' . $currencies->display_price2($listing_values['products_price'], tep_get_tax_rate($listing_values['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($listing_values['specials_new_products_price'], tep_get_tax_rate($listing_values['products_tax_class_id'])) . '</span> '; } else { $lc_text = ' ' . $currencies->display_price($listing_values['products_price'], tep_get_tax_rate($listing_values['products_tax_class_id'])) . ' '; } $lc_text = '<div class="productlistingprice">' . $lc_text . '</div>'; break; case 'PRODUCT_LIST_QUANTITY': $lc_align = 'right'; $lc_text = ' ' . $listing_values['products_quantity'] . ' '; break; case 'PRODUCT_LIST_WEIGHT': $lc_align = 'right'; $lc_text = ' ' . $listing_values['products_weight'] . ' '; break; case 'PRODUCT_LIST_IMAGE': $lc_align = 'center'; if ($HTTP_GET_VARS['manufacturers_id']) { $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing_values['products_id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . $listing_values['products_image'], $listing_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; } else { $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing_values['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing_values['products_image'], $listing_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> '; } break; case 'PRODUCT_LIST_BUY_NOW': $lc_align = 'center'; $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing_values['products_id'], 'NONSSL') . '">' . tep_image_button('button_buy_now.gif', TEXT_BUY . $listing_values['products_name'] . TEXT_NOW) . '</a> '; break; } $list_box_contents[$cur_row][] = array('align' => $lc_align, 'params' => 'class="productListing-data"', 'text' => $lc_text); } } new tableBox($list_box_contents, true); echo ' </td>' . "\n"; echo ' </tr>' . "\n"; } else {?> <tr class="productListing-odd"> <td class="smallText"> <?php echo ($HTTP_GET_VARS['manufacturers_id'] ? TEXT_NO_PRODUCTS2 : TEXT_NO_PRODUCTS); ?> </td> </tr><?php }?> <tr> <td><?php echo tep_draw_separator(); ?></td> </tr><?php if ($listing_numrows > 0 && (PREV_NEXT_BAR_LOCATION == '2' || PREV_NEXT_BAR_LOCATION == '3')) {?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText"> <?php echo $listing_split->display_count($listing_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?> </td> <td align="right" class="smallText"> <?php echo TEXT_RESULT_PAGE; ?> <?php echo $listing_split->display_links($listing_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?> </td> </tr> </table></td> </tr><?php }?></table> <?php/* $Id: products_new.php,v 1.21 2002/07/21 23:38:57 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 osCommerce Released under the GNU General Public License*/ require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCTS_NEW);// added for New Product Icon contribution $today_time = time();// end addition $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_PRODUCTS_NEW, '', 'NONSSL'));?><!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"><html <?php echo HTML_PARAMS; ?>><head><meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"><title><?php echo TITLE; ?></title><base href="<?php echo (getenv('HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"><link rel="stylesheet" type="text/css" href="stylesheet.css"></head><body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"><!-- header //--><?php require(DIR_WS_INCLUDES . 'header.php'); ?><!-- header_eof //--><!-- body //--><table border="0" width="100%" cellspacing="3" cellpadding="3"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"><!-- left_navigation //--><?php require(DIR_WS_INCLUDES . 'column_left.php'); ?><!-- left_navigation_eof //--> </table></td><!-- body_text //--> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_products_new.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><?php $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added DESC, pd.products_name"; $products_new_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_PRODUCTS_NEW, $products_new_query_raw, $products_new_numrows); $products_new_query = tep_db_query($products_new_query_raw); while ($products_new = tep_db_fetch_array($products_new_query)) { $products_new_array[] = array('id' => $products_new['products_id'], 'name' => $products_new['products_name'], 'image' => $products_new['products_image'], 'price' => $products_new['products_price'], 'specials_price' => $products_new['specials_new_products_price'], 'tax_class_id' => $products_new['products_tax_class_id'], 'date_added' => tep_date_long($products_new['products_date_added']), 'manufacturer' => $products_new['manufacturers_name']); } // added for New Product Icon contribution // convert times to unix timestamp for comparison // 2592000 = 30 days in the unix timestamp format if ( ($today_time - strtotime($products_new['products_date_added']) ) < 2592000) { $products_new['products_name'] .= ' ' . tep_image_button('icon_newarrival.gif', TEXT_ICON_NEW_PRODUCT); } // end addition New Product Icon contribution require(DIR_WS_MODULES . 'products_new.php');?> </td> </tr><?php if ($products_new_numrows > 0 && (PREV_NEXT_BAR_LOCATION == '2' || PREV_NEXT_BAR_LOCATION == '3')) {?> <tr> <td><br><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText"><?php echo $products_new_split->display_count($products_new_numrows, MAX_DISPLAY_PRODUCTS_NEW, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW); ?></td> <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE; ?> <?php echo $products_new_split->display_links($products_new_numrows, MAX_DISPLAY_PRODUCTS_NEW, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td> </tr> </table></td> </tr><?php }?> </table></td><!-- body_text_eof //--> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"><!-- right_navigation //--><?php require(DIR_WS_INCLUDES . 'column_right.php'); ?><!-- right_navigation_eof //--> </table></td> </tr></table><!-- body_eof //--><!-- footer //--><?php require(DIR_WS_INCLUDES . 'footer.php'); ?><!-- footer_eof //--><br></body></html><?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Thank you very much for Help! Andreas Quote Link to comment Share on other sites More sharing options...
kn-medien Posted February 8, 2008 Share Posted February 8, 2008 (edited) Just a few posts above, the solution to your problem is posted. http://www.oscommerce.com/forums/index.php?s=&...st&p=791883 . -jared Hello, i have the same Problem with the ALT-TAGS. I have make the Change few posts above, but now i have no NEW-IMAGE more :'( Is here only 1 People, who this Contribution works without the failure? Andreas Edited February 8, 2008 by kn-medien Quote Link to comment Share on other sites More sharing options...
♥stubbsy Posted November 3, 2008 Share Posted November 3, 2008 I have a small problem which hopefully someone will be able to help with... In the product_listing module I have been using $listing['products_name'] to add a title tag to the link e.g. $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '" title="' . $listing['products_name'] . ' some additional text">' . $listing['products_name'] . '</a> '; This causes a problem though when adding this code for this contribution as I have $listing['products_name'] used twice // added for New Product Icon contribution // 2592000 = 30 days in the unix timestamp format if ( ($today_time - strtotime($listing['products_date_added'])) < 2592000) { $listing['products_name'] .= ' ' . tep_image_button('icon_newarrival.gif', TEXT_ICON_NEW_PRODUCT. ' : ' . $listing['products_name'], 'align="middle"'); } // end addition I've tried a number of ways to get around it but can't get any of them to work Anyone have any clever ideas? Thanks Dave Quote Link to comment Share on other sites More sharing options...
luvubeauty Posted July 6, 2009 Share Posted July 6, 2009 OK! I have done, and re done this add on and cannot get it to work! The new icon isn't showing on the product description or by the product in the product listings (categories) I have read right through this forum and found nothing....any ideas on what I could of done wrong? Quote Link to comment Share on other sites More sharing options...
Guest Posted August 8, 2009 Share Posted August 8, 2009 There is a small bug in the last version of this great add-on. In the readme.txt find: PRODUCT.. and remove the extra . so it now shows PRODUCT. Also I was hoping for the new blinking icon but it wasn't included in the download for some reason. Quote Link to comment Share on other sites More sharing options...
serplanet Posted August 20, 2009 Share Posted August 20, 2009 Hello,i want to show icons next to my product image when it has a special price or if it is a best seller product. Is it possible to remake this contribution for Special Price & Best Sellers? thanks Quote Link to comment Share on other sites More sharing options...
yvonnejoey8 Posted September 20, 2009 Share Posted September 20, 2009 Hello,i want to show icons next to my product image when it has a special price or if it is a best seller product.Is it possible to remake this contribution for Special Price & Best Sellers? thanks any idea how to change the timing..ie from the default 30 days to maybe say 7 days? Quote Link to comment Share on other sites More sharing options...
germ Posted September 20, 2009 Share Posted September 20, 2009 Look at the code: // 2592000 = 30 days in the unix timestamp format At that rate ! day= 86400 7 days = 604800 Quote 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 > Link to comment Share on other sites More sharing options...
kay666 Posted October 2, 2009 Share Posted October 2, 2009 I have put the contribution to my osCommerce web site, but the new icon doesnt show. Instead of it, i have a button with the name of product on it. I am using this code: // added for New Product Icon contribution // 2592000 = 30 days in the unix timestamp format if ( ($today_time - strtotime($product_info['products_date_added'] ) ) < 2592000) { $img_new_product = tep_image_button('icon_newarrival.gif', TEXT_ICON_NEW_PRODUCT . ' : ' . $product_info['products_name']); } // end addition for New Product Icon contribution Any ideas? Thanks! Nope. The key code is as follows: // added for New Product Icon contribution // 2592000 = 30 days in the unix timestamp format if ( ($today_time - strtotime($listing['products_date_added'])) < 2592000) { $listing['products_name'] .= ' <img src="images/icon_newarrival.gif" alt="new product" border="0">'; } // end addition for New Product Icon contribution As you can see, the logic is that all products are old unless they were added over 30 days ago. The problem is that if this code gets called with a query that has not retrieved the products_date_added field from the database, then the value for this field will be assumed to be zero. Since zero is always less than 30 days, it will get the new icon. That's what was happening with the advanced_search_result.php. You can't tell how old something is without looking at the products_date_added field. -jared Quote Link to comment Share on other sites More sharing options...
subster Posted October 8, 2009 Share Posted October 8, 2009 OH MY GOD! I just realized a strange Problem, and i hope you can help me with that! When the thirty days are over and the new-flag disappears, the the whole title in the product-view is gone! Do you have any idea? The checkbox doesnt uncheck automatically after thirty days, in the admin the date is over, but its still checked, the new-flag is gone - just as the title... Please give me a hint. Could this be go together with the installation of seo-urls? Quote Link to comment Share on other sites More sharing options...
ryder Posted November 10, 2009 Share Posted November 10, 2009 I have installed the New Products Icon v1.5 add-on. I can't get the regular catalog listing to add, this contribution a "new" icon next to the product's name if the product was added to your store within the past 30 days. I have now followed the instructions 3 times, and don't get any error of faulty, so something must be missing in the instructions of code. The other parts are OK, but the key thing I would like to have is the "new" icon at new products when listing the catalog will not appear. Any one that can help on this issue? Quote Link to comment Share on other sites More sharing options...
Guest Posted July 8, 2010 Share Posted July 8, 2010 Hello, i have just installed version 1.5 of this contribution on OSC v2.2 RC2. I get the New-icon only when i view the details of a new product. I have discovered, that the variable $listing['products_date_added'] in product-listing.php and the variable $new_products['products_date_added'] in new_products.php are empty. Where will this variables be set? What must i change or add? Thanks a lot for any help... Thomas Quote Link to comment Share on other sites More sharing options...
Swedaporean Posted October 14, 2010 Share Posted October 14, 2010 Hello, i have just installed version 1.5 of this contribution on OSC v2.2 RC2. I get the New-icon only when i view the details of a new product. I have discovered, that the variable $listing['products_date_added'] in product-listing.php and the variable $new_products['products_date_added'] in new_products.php are empty. Where will this variables be set? What must i change or add? Thanks a lot for any help... Thomas I have the same issue as you. However, if I move the section with the timestamp and product_date_added furhter down on the page it works but then I get another issue. This is what happens: The "new" tag will appear correct for the first product that is considered new, but after this product every single product in the listing (on the same page) will have the tag as well independent if it's new or not. If you then click on the second page everything is fine again until a product that is considered new comes along, because after that product every product on that page will have the tag. What can be wrong when this happens? Cheers, Swedaporean Quote Link to comment Share on other sites More sharing options...
LizSA Posted May 25, 2011 Share Posted May 25, 2011 Hi there, thank you for your contribution... it kinda works on my site. I have however installed a contribution which makes my product listings display in columns and not as a a default list so my products are not displaying the "new icon". It is working in the new products and the product_info.php page. TVR Quote Link to comment Share on other sites More sharing options...
LizSA Posted May 25, 2011 Share Posted May 25, 2011 I can see what is going on but I am not sure how to edit the product_listing module. The column listing module refures to a new file, how do I edit this new product listing file. <?php /* $Id: product_listing.php, v1.44 2003/06/09 22:49:43 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ // added for New Product Icon contribution $today_time = time(); // end addition for New Product Icon contribution //if number of column per row is 1, include the original product_listing.php if (PRODUCT_LIST_NUMCOL == 1) { include(dirname(__FILE__).'/product_listing.php'); } else { $list_box_contents = array(); $list_box_contents[] = array('params' => 'class="productListing-heading"'); $cur_row = sizeof($list_box_contents) - 1; // three variables that determine a certain output $use_tr_for_buy_now_button = false; $add_multiple = false; $use_of_attributes = false; for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { switch ($column_list[$col]) { case 'PRODUCT_LIST_MULTIPLE': $add_multiple = true; $use_of_attributes = true; echo '<form name="buy_now_" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'sort', 'products_id')) . 'action=add_multiple', 'NONSSL') . '">'; break; case 'PRODUCT_LIST_BUY_NOW_MULTIPLE': $use_of_attributes = true; break; case 'PRODUCT_LIST_BUY_NOW': $use_tr_for_buy_now_button = true; break; } } $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id'); if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) { ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td> <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y', 'products_id'))); ?></td> </tr> </table> <?php } $list_box_contents = array(); if ($listing_split->number_of_rows > 0) { if (PRODUCT_LIST_NUMCOL <= 0) { $colnum = 3; $tdsize = floor(100/3); } else { $colnum = PRODUCT_LIST_NUMCOL; $tdsize = floor(100/PRODUCT_LIST_NUMCOL); } $row = 0; $column = 0; $listing_query = tep_db_query($listing_split->sql_query); $no_of_listings = tep_db_num_rows($listing_query); while ($_listing = tep_db_fetch_array($listing_query)) { $_listing['total'] = ''; // for number of attributes $listing[] = $_listing; $list_of_prdct_ids[] = $_listing['products_id']; } // lets save all the separate count queries that check if a product has attributes // and do it in one (if needed) if ($use_of_attributes == true) { $products_attributes_count_query = tep_db_query("select count(*) as total, patrib.products_id from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id in (" . implode(',', $list_of_prdct_ids) . ") and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "' group by products_id"); while ($_products_attributes_count = tep_db_fetch_array($products_attributes_count_query)) { $products_attributes_count[] = array('products_id' => $_products_attributes_count['products_id'], 'total' => $_products_attributes_count['total']); } $no_of_products_with_attributes = count($products_attributes_count); for ($x = 0; $x < $no_of_listings; $x++) { if (!empty($products_attributes_count)) { for ($i = 0; $i < $no_of_products_with_attributes; $i++) { if ($listing[$x]['products_id'] == $products_attributes_count[$i]['products_id'] ) { $listing[$x]['total'] = $products_attributes_count[$i]['total']; } } } } // end for ($x = 0; $x < $no_of_listings; $x++) } // end ($use_of_attributes == true) // an extra query is used for all the specials because joining the table specials in a query // often results in a slow query if you haven't added additional indexes to that table // see http://www.oscommerce.com/forums/index.php?s=&showtopic=119077&view=findpost&p=1118789 and further $specials_query = tep_db_query("select products_id, specials_new_products_price from " . TABLE_SPECIALS . " where products_id in (" . implode(',', $list_of_prdct_ids) . ") and status = '1'"); while ($specials_array = tep_db_fetch_array($specials_query)) { $new_s_prices[] = array ('products_id' => $specials_array['products_id'], 'products_price' => '', 'specials_new_products_price' => $specials_array['specials_new_products_price']); } // add the correct specials_new_products_price and replace final_price for ($x = 0; $x < $no_of_listings; $x++) { if (!empty($new_s_prices)) { for ($i = 0; $i < count($new_s_prices); $i++) { if ($listing[$x]['products_id'] == $new_s_prices[$i]['products_id'] ) { $listing[$x]['specials_new_products_price'] = $new_s_prices[$i]['specials_new_products_price']; } } } // end if (!empty($new_s_prices) } // end for ($x = 0; $x < $no_of_listings; $x++) $counter = 0; $class_for_buy_now = 'class="productListing-data" width="' . $tdsize . '%"'; for ($x = 0; $x < $no_of_listings; $x++) { if ($x % PRODUCT_LIST_NUMCOL == 0) { // start of new row if (($counter+1)/2 == floor(($counter+1)/2)) { // start with the background color productListing-odd //if ($counter/2 == floor($counter/2)) { // if you want to start with the background color productListing-even use this $list_box_contents[$row] = array('params' => 'class="productListing-even"'); $class_for_buy_now_row = 'class="productListing-even"'; } else { $list_box_contents[$row] = array('params' => 'class="productListing-odd"'); $class_for_buy_now_row = 'class="productListing-odd"'; } } // end if ($x % PRODUCT_LIST_NUMCOL == 0) $product_contents = array(); for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { $lc_align = ''; switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $lc_align = ''; $lc_text = ' ' . $listing[$x]['products_model'] . ' '; break; case 'PRODUCT_LIST_NAME': $lc_align = ''; if (isset($_GET['manufacturers_id'])) { $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . (int)$_GET['manufacturers_id'] . '&products_id=' . $listing[$x]['products_id']) . '">' . $listing[$x]['products_name'] . '</a>'; } else { $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . $listing[$x]['products_name'] . '</a> '; } break; case 'PRODUCT_LIST_MANUFACTURER': $lc_align = ''; $lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing[$x]['manufacturers_id']) . '">' . $listing[$x]['manufacturers_name'] . '</a> '; break; case 'PRODUCT_LIST_PRICE': $lc_align = 'right'; if (tep_not_null($listing[$x]['specials_new_products_price'])) { $lc_text = ' <s>' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($listing[$x]['specials_new_products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</span> '; } else { $lc_text = ' ' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . ' '; } break; case 'PRODUCT_LIST_QUANTITY': $lc_align = 'right'; $lc_text = ' ' . $listing[$x]['products_quantity'] . ' '; break; case 'PRODUCT_LIST_WEIGHT': $lc_align = 'right'; $lc_text = ' ' . $listing[$x]['products_weight'] . ' '; break; case 'PRODUCT_LIST_IMAGE': $lc_align = 'center'; if (isset($_GET['manufacturers_id'])) { $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . (int)$_GET['manufacturers_id'] . '&products_id=' . $listing[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; } else { $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> '; } break; case 'PRODUCT_LIST_BUY_NOW': // this button will be in a separate table row for better aligning $buy_now_button_array[] = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','sort','products_id')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW, 'style="padding-top: 5px;"') . '</a> '; $lc_text = ''; // otherwise the previous $lc_text will be outputted again break; // Begin Buy Now button with attributes and quantity mod // Begin Add Multiple with attributes Contrib case 'PRODUCT_LIST_MULTIPLE': $lc_align = 'right'; $lc_valign = 'top'; $lc_text = (TABLE_HEADING_MULTIPLE . tep_draw_input_field('Qty_ProdId_' . $listing[$x]['products_id'], '0', 'size="4"')); if ((int)$listing[$x]['total'] > 0) { $lc_text .= '<table border="0" cellpadding="0" cellspacing"0">'; $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing[$x]['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'"); while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { $selected_attribute = false; $products_options_array = array(); $lc_text .= '<tr><td class="main">' . $products_options_name['products_options_name'] . ':</td><td>' . "\n"; $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . $listing[$x]['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'"); $list_of_prdcts_attributes_id = ''; $products_options = array(); // makes sure this array is empty again while ($_products_options = tep_db_fetch_array($products_options_query)) { $products_options[] = $_products_options; } for ($v = 0 ; $v < count($products_options); $v++) { $options_text = ''; // make it empty again $options_text = $products_options[$v]['products_options_values_name']; if (defined('PRODUCT_LIST_ACTUAL_PRICE_IN_DROPDOWN') && PRODUCT_LIST_ACTUAL_PRICE_IN_DROPDOWN == 'Yes') { //if ((int) $products_options[$v]['options_values_price'] != '0') { if (tep_not_null($listing[$x]['specials_new_products_price'])) { $original_price = $listing[$x]['specials_new_products_price']; } else { $original_price = $listing[$x]['products_price']; } if ($products_options[$v]['price_prefix'] == "-") { // in case price lowers, don't add values, subtract $show_price = 0.0 + $original_price - $products_options[$v]['options_values_price']; // force float (in case) using the 0.0; } else { $show_price = 0.0 + $original_price + $products_options[$v]['options_values_price']; // force float (in case) using the 0.0; } $options_text .= ' (' . $currencies->display_price($show_price, tep_get_tax_rate($listing[$x]['products_tax_class_id'])) .') '; //} } else { if ($products_options[$v]['options_values_price'] != '0') { $options_text .= ' (' . $products_options[$v]['price_prefix'] . $currencies->display_price($products_options[$v]['options_values_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) .') '; } } $products_options_array[] = array('id' => $products_options[$v]['products_options_values_id'], 'text' => $options_text); } // end for ($v = 0 ; $v < count($products_options); $v++) $lc_text .= tep_draw_pull_down_menu('id_'.$listing[$x]['products_id'].'[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); $lc_text .= '</td></tr>'; } $lc_text .= '</table>'; } break; case 'PRODUCT_LIST_BUY_NOW_MULTIPLE': $lc_align = 'right'; $lc_valign = 'top'; $lc_text = '<form name="buy_now_' . $listing[$x]['products_id'] . '" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','sort','products_id')) . 'action=buy_now_form', 'NONSSL') . '">'; $lc_text .= (TABLE_HEADING_MULTIPLE) . '<input type="text" name="cart_quantity" value="1" maxlength="6" size="4">'; if ((int)$listing[$x]['total'] > 0) { $lc_text .= '<table border="0" cellpadding="0" cellspacing"0">'; $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing[$x]['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'"); while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { $selected_attribute = false; $products_options_array = array(); $lc_text .= '<tr><td class="main">' . $products_options_name['products_options_name'] . ':</td><td>' . "\n"; $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . $listing[$x]['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'"); $list_of_prdcts_attributes_id = ''; $products_options = array(); // makes sure this array is empty again while ($_products_options = tep_db_fetch_array($products_options_query)) { $products_options[] = $_products_options; } for ($v = 0 ; $v < count($products_options); $v++) { $options_text = ''; // make it empty again $options_text = $products_options[$v]['products_options_values_name']; if (defined('PRODUCT_LIST_ACTUAL_PRICE_IN_DROPDOWN') && PRODUCT_LIST_ACTUAL_PRICE_IN_DROPDOWN == 'Yes') { if (tep_not_null($listing[$x]['specials_new_products_price'])) { $original_price = $listing[$x]['specials_new_products_price']; } else { $original_price = $listing[$x]['products_price']; } if ($products_options[$v]['price_prefix'] == "-") { // in case price lowers, don't add values, subtract $show_price = 0.0 + $original_price - $products_options[$v]['options_values_price']; // force float (in case) using the 0.0; } else { $show_price = 0.0 + $original_price + $products_options[$v]['options_values_price']; // force float (in case) using the 0.0; } $options_text .= ' (' . $currencies->display_price($show_price, tep_get_tax_rate($listing[$x]['products_tax_class_id'])) .') '; } else { if ($products_options[$v]['options_values_price'] != '0') { $options_text .= ' (' . $products_options[$v]['price_prefix'] . $currencies->display_price($products_options[$v]['options_values_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) .') '; } } $products_options_array[] = array('id' => $products_options[$v]['products_options_values_id'], 'text' => $options_text); } // end for ($v = 0 ; $v < count($products_options); $v++) $lc_text .= tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); $lc_text .= '</td></tr>'; } $lc_text .= '</table>'; $lc_text .= tep_draw_hidden_field('products_id', $listing[$x]['products_id']) . tep_image_submit('button_buy_now.gif', TEXT_BUY . $listing[$x]['products_name'] . TEXT_NOW); } // end if ((int)$listing[$x]['total'] > 0) if ((int)$listing[$x]['total'] == 0) { $lc_text .= '<br> '; $lc_text .= tep_draw_hidden_field('products_id', $listing[$x]['products_id']) . tep_image_submit('button_buy_now.gif', TEXT_BUY . $listing[$x]['products_name'] . TEXT_NOW); $lc_text .= '<br> '; $lc_text .= '<table border="0" cellpadding="0" cellspacing"0"><tr><td class="main"></td><td></td></tr></table>'; } $lc_text .= '</form>'; break; // End Add Multiple mod default: $lc_text = ''; } $product_contents[] = $lc_text; } $lc_text = implode('<br>', $product_contents); $list_box_contents[$row][$column] = array( 'align' => 'center', 'valign' => $lc_valign, 'params' => 'class="productListing-data" width="'.$tdsize.'%"', 'text' => $lc_text ); $column ++; if ($x == ($no_of_listings -1)) { $last_column = ($x % PRODUCT_LIST_NUMCOL); // x modulus number of columns // fill up the remainder of the table row with empty cells for ($column = ($last_column + 1) ; $column < $colnum; $column++) { $list_box_contents[$row][$column] = array( 'align' => 'center', 'valign' => $lc_valign, 'params' => 'class="productListing-data" width="'.$tdsize.'%"', 'text' => " "); } } if ($column >= $colnum && $x < ($no_of_listings -1)) { $row ++; // we start a new tr here with $list_box_contents unless we already listed all products // $list_box_contents[$row] = array('params' => $class_for_buy_now); $column = 0; $counter++; // counter only goes up after the buy now buttons have been outputted, counts the real rows if ($use_tr_for_buy_now_button == true) { // make sure all data cells per row are filled $last_column = sizeof($buy_now_button_array); for ($zz = $last_column ; $zz < PRODUCT_LIST_NUMCOL; $zz++) { $buy_now_button_array[] = " "; } $list_box_contents[$row] = array('params' => $class_for_buy_now_row); foreach ($buy_now_button_array as $column1 => $lc_text1) { $list_box_contents[$row][$column1] = array( 'align' => 'center', 'params' => 'class="productListing-data"', 'text' => $lc_text1 ); } unset($buy_now_button_array); $row ++; } // end if ($use_tr_for_buy_now_button == true) // output the last row with buy now buttons if needed } elseif ($x == ($no_of_listings -1) && $use_tr_for_buy_now_button == true) { $row ++; // we start a new tr here with $list_box_contents for the last row with buy now buttons // make sure all data cells per row are filled $last_column = sizeof($buy_now_button_array); for ($zz = $last_column ; $zz < PRODUCT_LIST_NUMCOL; $zz++) { $buy_now_button_array[] = " "; } $list_box_contents[$row] = array('params' => $class_for_buy_now_row); foreach ($buy_now_button_array as $column1 => $lc_text1) { $list_box_contents[$row][$column1] = array( 'align' => 'center', 'params' => $class_for_buy_now, 'text' => $lc_text1 ); } unset($buy_now_button_array); } // end elseif ($x == ($no_of_listings -1) && $use_tr_for_buy_now_button == true) } // end for ($x = 0; $x < $no_of_listings; $x++) new productListingBox($list_box_contents); } else { $list_box_contents = array(); //$list_box_contents[0] = array('params' => 'class="productListing-odd"'); $list_box_contents[0][] = array( 'params' => 'class="productListing-data"', 'text' => TEXT_NO_PRODUCTS ); new productListingBox($list_box_contents); } if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) { ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td> <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y','products_id'))); ?></td> </tr> <?php if ($add_multiple == true){ ?> <tr> <td align="left" class="main"> </td> <td align="right" class="main"><?php echo tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></form></td> </tr> <?php } ?> </table> <?php } } ?> Quote Link to comment Share on other sites More sharing options...
arkisaeo Posted August 22, 2011 Share Posted August 22, 2011 Having some issues with installing this. A couple of the files are already modded (though I can't remember which contribs I added to them), and some content is missing, so I'm not sure where to add the code. Here's where the issues lie: Still in catalog/products_new.php, find the following code (line 77 in original 2.2 MS2 code): <?php if ($products_new_split->number_of_rows > 0) { $products_new_query = tep_db_query($products_new_split->sql_query); while ($products_new = tep_db_fetch_array($products_new_query)) { if ($new_price = tep_get_products_special_price($products_new['products_id'])) { $products_price = '<s>' . $currencies->display_price($products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($products_new['products_tax_class_id'])) . '</span>'; } else { $products_price = $currencies->display_price($products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id'])); } Add the following afterwards: // added for New Product Icon contribution // convert times to unix timestamp for comparison // 2592000 = 30 days in the unix timestamp format if ( ($today_time - strtotime($products_new['products_date_added']) ) < 2592000) { $products_new['products_name'] .= ' ' . tep_image_button('icon_newarrival.gif', TEXT_ICON_NEW_PRODUCT. ' : ' . $products_new['products_name']); } // end addition New Product Icon contribution ^^^ That section in red is missing from the products_new.php file. And I'm not sure where to add the new code below it...(or if I even can) Here's the actual code I do have for that file::: <?php /* $Id: products_new.php v2.8 2009-12-31 00:52:16Z hpdl $ modified for thumbnail view 2007-07-24 osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); unset($_GET['manufacturers_id']); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCTS_NEW); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT); $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_PRODUCTS_NEW)); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> <?php include (DIR_WS_INCLUDES . 'page-header-inc.htc'); ?> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="3" cellpadding="3"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="right"></td> </tr> </table></td> </tr> <?php $products_new_array = array(); $max_age = tep_not_null( MAX_DISPLAY_PRODUCTS_NEW_AGE ) ? MAX_DISPLAY_PRODUCTS_NEW_AGE : 60; // set max age of displayed product $date = strtotime("-" . $max_age . " days"); $date = strftime("%Y-%m-%d",$date); $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL, 'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME, 'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER, 'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE, 'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY, 'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT, 'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE, 'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW); asort($define_list); $column_list = array(); reset($define_list); while (list($key, $value) = each($define_list)) { if ($value > 0) $column_list[] = $key; } $select_column_list = ''; for ($i=0, $n=sizeof($column_list); $i<$n; $i++) { switch ($column_list[$i]) { case 'PRODUCT_LIST_MODEL': $select_column_list .= 'p.products_model, '; break; case 'PRODUCT_LIST_NAME': $select_column_list .= 'pd.products_name, '; break; case 'PRODUCT_LIST_MANUFACTURER': $select_column_list .= 'm.manufacturers_name, '; break; case 'PRODUCT_LIST_QUANTITY': $select_column_list .= 'p.products_quantity, '; break; case 'PRODUCT_LIST_WEIGHT': $select_column_list .= 'p.products_weight, '; break; } } $sort_sql=''; if ( (!isset($_GET['sort'])) || (!ereg('^[1-8][ad]$', $_GET['sort'])) || (substr($_GET['sort'], 0, 1) > sizeof($column_list)) ) { $_GET['sort'] = 0 . 'd'; $sort_sql = " order by p.products_date_added DESC, pd.products_name"; } else { $sort_col = substr($_GET['sort'], 0 , 1); $sort_order = substr($_GET['sort'], 1); switch ($column_list[$sort_col-1]) { case 'PRODUCT_LIST_MODEL': $sort_sql .= " order by p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_NAME': $sort_sql .= " order by pd.products_name " . ($sort_order == 'd' ? 'desc' : ''); break; case 'PRODUCT_LIST_MANUFACTURER': $sort_sql .= " order by m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_QUANTITY': $sort_sql .= " order by p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_IMAGE': $sort_sql .= " order by pd.products_name"; break; case 'PRODUCT_LIST_WEIGHT': $sort_sql .= " order by p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_PRICE': $sort_sql .= " order by p.products_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; } } $products_new_query_raw = "select " . $select_column_list . "p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name, p.manufacturers_id 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_date_added > '".$date."' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'" . $sort_sql; $listing_sql = $products_new_query_raw; $new_page = true; ?> <tr> <td><?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?></td> </tr> </table></td> <!-- body_text_eof //--> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> And here's the other issue: Still in new_products.php, find the following code $row = 0; $col = 0; $info_box_contents = array(); while ($new_products = tep_db_fetch_array($new_products_query)) { Immediately after that, add the following code: // added for New Product Icon contribution // 2592000 = 30 days in the unix timestamp format if ( ($today_time - strtotime($new_products['products_date_added'])) < 5184000) { $new_products['products_name'] .= ' ' . tep_image_button('icon_newarrival.gif', TEXT_ICON_NEW_PRODUCT . ' : ' . $new_products['products_name']); } // end addition for New Product Icon contribution ^^^ Again, the code in red is also missing from new_products.php. And I'm not sure where to add the new code below it (or if it's even possible...) Here is the actual code I have for that file::: <?php /* $Id: new_products.php v2.8 2009-12-31 22:48:15Z hpdl $ modified for thumbnail view 2007-07-24 osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2008 osCommerce Released under the GNU General Public License */ ?> <!-- new_products //--> <?php $max_age = tep_not_null( MAX_DISPLAY_PRODUCTS_NEW_AGE ) ? MAX_DISPLAY_PRODUCTS_NEW_AGE : 60; // set max age of displayed product $date = strtotime("-" . $max_age . " days"); $date = strftime("%Y-%m-%d",$date); $new_mode = sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')); $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL, 'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME, 'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER, 'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE, 'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY, 'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT, 'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE, 'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW); asort($define_list); $column_list = array(); reset($define_list); while (list($key, $value) = each($define_list)) { if ($value > 0) $column_list[] = $key; } $select_column_list = ''; for ($i=0, $n=sizeof($column_list); $i<$n; $i++) { switch ($column_list[$i]) { case 'PRODUCT_LIST_MODEL': $select_column_list .= 'p.products_model, '; break; case 'PRODUCT_LIST_NAME': $select_column_list .= 'pd.products_name, '; break; case 'PRODUCT_LIST_MANUFACTURER': $select_column_list .= 'm.manufacturers_name, '; break; case 'PRODUCT_LIST_QUANTITY': $select_column_list .= 'p.products_quantity, '; break; case 'PRODUCT_LIST_WEIGHT': $select_column_list .= 'p.products_weight, '; break; } } $order = ' order by p.products_date_added desc'; // $order = ' order by rand()'; // uncomment if you want products in a random order if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { $new_products_query = "select " . $select_column_list . "p.products_id, p.products_image, p.products_tax_class_id, p.products_price, p.products_quantity 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_date_added > '".$date."' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'" . $order; } else { $new_products_query = "select distinct " . $select_column_list . "p.products_id, p.products_image, p.products_tax_class_id, p.products_price, p.products_quantity from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_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_date_added > '".$date."' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'" . $order; } $listing_sql = $new_products_query; include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?> <!-- new_products_eof //--> Quote Link to comment Share on other sites More sharing options...
KomplikatedOne Posted September 19, 2011 Share Posted September 19, 2011 got this to work eventually, the current instructions are a bit out of date due to the version change for the most the original instructions work apart from.. step 4 i had to place the code elsewhere look for the 2nd appearance of this line case 'PRODUCT_LIST_NAME': and place the code directly beneath on step 5 you are looking for the line: } else { $products_price = $currencies->display_price($products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id'])); } and adding the line directly underneath that on step 8, the last part, you looking for a line containining: <h1><?php echo $products_name; ?></h1> and change to <h1><?php echo $img_new_product . $products_name; ?></h1> ill add note to the contribution if it will let me Quote Link to comment Share on other sites More sharing options...
KomplikatedOne Posted September 26, 2011 Share Posted September 26, 2011 as it still wont let me add files to contributions i have attached a new install.txt file that contains updated instructions for v2.3.1 ive also added a little variable to make the changing of the time frame a bit easier install.txt Quote Link to comment Share on other sites More sharing options...
dculley Posted January 25, 2015 Share Posted January 25, 2015 I came across this add on and was very excited. But unable to get to work. I'm using OSC 2.3.4 and I know the new layout is really different since the first creation. I'm not a programer and do not know what to do to get this work. I used the above install.txt as my guide. I have done step 1, 2, 3, 4 and 8. I skipped over 5,6 & 7. Because I would like it work on products_info.php. The reset is not important to me. If I can get it work in products_info.php I probably can get this contribution to work on the rest. Looking for help. Can anyone help to get this up and running? I would be very thank full. Quote 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.