robster2 Posted January 10, 2014 Posted January 10, 2014 Hi all, How can I display special and full price in new_products and product_listing.php (with strike through) just like in the specials or new product boxes? It was a simple copy/paste job in v2.2 I remember but with v2.3 it seems a lot more difficult, at least for me. A buy now button would also be great. Thanks in advance Rob
robster2 Posted January 11, 2014 Author Posted January 11, 2014 Ok I figured out the button but still dont have a clue about the specials, no info in the forum about it either, can someone point me in the right direction please. Im suprised that this is not a feature in a standard setup, we all want to show our customers that there is a sale going on.
♥14steve14 Posted January 11, 2014 Posted January 11, 2014 I think it is a standard feature on the product listing page, at least it is on my test site. I get the standard price which is striked through and next to it there is the special price, right next to a buy it now button. REMEMBER BACKUP, BACKUP AND BACKUP
robster2 Posted January 11, 2014 Author Posted January 11, 2014 Only in sub categories where the product list strecthes all over the page, have tried to make that code work for main cats and new products without any luck, Im no wizard in coding though.
Bob Terveuren Posted January 11, 2014 Posted January 11, 2014 Hi - If you compare inc/modules/product_listing.php with inc/modules/new_products.php and look at the sql queries there is a difference in that the former has if(s.status, s.specials_new_products_price, p.products_price) as products_price and the latter IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price So one is setup to display just products_price (i.e. special price if available otherwise full price) whilst the other can display both. Strikes me that we're missing a sales angle here! Try this for inc/modules/new_products.php: <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2010 osCommerce Released under the GNU General Public License */ 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, pd.products_name,IF(s.status, s.specials_new_products_price, NULL) as 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_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 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, NULL) as 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_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); } $num_new_products = tep_db_num_rows($new_products_query); if ($num_new_products > 0) { $counter = 0; $col = 0; $new_prods_content = '<table border="0" width="100%" cellspacing="0" cellpadding="2">'; while ($new_products = tep_db_fetch_array($new_products_query)) { $counter++; if ($col === 0) { $new_prods_content .= '<tr>'; } if (tep_not_null($new_products['specials_new_products_price'])) { $new_prods_content .= '<td width="33%" align="center" valign="top"><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 /> <del>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</del><br /> <span class="productSpecialPrice">' . $currencies->display_price($new_products['specials_new_products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</span></td>'; }else{ $new_prods_content .= '<td width="33%" align="center" valign="top"><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 />' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</td>'; } $col ++; if (($col > 2) || ($counter == $num_new_products)) { $new_prods_content .= '</tr>'; $col = 0; } } $new_prods_content .= '</table>'; ?> <h2><?php echo sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')); ?></h2> <div class="contentText"> <?php echo $new_prods_content; ?> </div> <?php } ?>
robster2 Posted January 13, 2014 Author Posted January 13, 2014 Now we're talking, works like a dream, thanks a lot Bob! This is definitely a setting that should be controllable from admin.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.