squeekit Posted October 7, 2006 Posted October 7, 2006 [ :-" title should be "display Regular & Special price in main WHAT'S NEW box" ] the MAIN "What's New for..." box (that appears at the center bottom of main pages) only shows the special price if one existed - and shows it unhighlighted - I think it's better to bring attention to specails - so i changed my "What's New for..." box in a way that will display both these prices, highlighting the special, just as they are displayed in the infoboxes that appear everywhere else, particularly the way they display in the info boxes within the left and riight columns (thanks goes to boeaz for giving me this idea - the following is what i developed for him with minor changes). also when viewing categories the MAIN "What's New for..." box only displays products within the category being currently viewed - i changed such to indicate that what is displayed in this box is only from the category being currently viewed... - the following is the entire modified file... include/modules/new_products.php: <?php /* $Id: new_products.php,v 1.34 2003/06/09 22:49:58 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ ?> <!-- new_products //--> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => (tep_not_null($category['categories_name'])? $category['categories_name'] . ' - ' : '') . sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B'))); new contentBoxHeading($info_box_contents); 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, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where 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, s.specials_new_products_price, p.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' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } $row = 0; $col = 0; $info_box_contents = array(); while ($new_products = tep_db_fetch_array($new_products_query)) { $new_products['products_name'] = tep_get_products_name($new_products['products_id']); if ($new_products['specials_new_products_price'] > 0) $new_price = tep_get_products_special_price($new_products['products_id']); $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="33%" valign="bottom"', 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>' . (($new_products['specials_new_products_price'] > 0) ? '<s>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($new_products['products_tax_class_id'])) . '</span>' : $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '<br>?')); $col ++; if ($col > 2) { $col = 0; $row ++; } } new contentBox($info_box_contents); ?> <!-- new_products_eof //--> ALL FEEDBACK WELCOMED...
squeekit Posted October 7, 2006 Author Posted October 7, 2006 additional notes: FYI: this is the area (from above code) that indicates products are being displayed only from the category being currently viewed: <!-- new_products //--> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => (tep_not_null($category['categories_name'])? $category['categories_name'] . ' - ' : '') . sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B'))); the effect is the What's New header now displays like this... if currently viewing 'Hardware': 'Hardware - What's New for October' - if at top level it only displays: 'What's New for October' - AND - an option that I use which brings even more attention to the special prices only requires two more tiny steps... (bottom of) include/modules/new_products.php change this area: 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>' . (($new_products['specials_new_products_price'] > 0) ? '<s>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($new_products['products_tax_class_id'])) . '</span>' : $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '<br> ')); $col ++; if ($col > 2) { $col = 0; $row ++; } } new contentBox($info_box_contents); ?> <!-- new_products_eof //--> by inserting TABLE_NEW_PRODUCT_SPECIALS . so it is as follows... 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>' . (($new_products['specials_new_products_price'] > 0) ? '<s>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . TABLE_NEW_PRODUCT_SPECIALS . $currencies->display_price($new_price, tep_get_tax_rate($new_products['products_tax_class_id'])) . '</span>' : $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '<br>?')); $col ++; if ($col > 2) { $col = 0; $row ++; } } new contentBox($info_box_contents); ?> <!-- new_products_eof //--> THEN open includes/languages/english/index.php to add the following line under a simular define statement... define('TABLE_NEW_PRODUCT_SPECIALS', 'Special ');
GeorgeP Posted May 1, 2007 Posted May 1, 2007 This sounds very cool!! It would be nice if you could tell only the differences from the original file :) like in post #2
Recommended Posts
Archived
This topic is now archived and is closed to further replies.