supergrizz Posted February 3, 2004 Share Posted February 3, 2004 $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) I have taken that part out of the code in /includes/modules/new_products.php becasue it diplays the retail prices, but not the Specials price like every other infobox! This is the file that is responsible for the 'New Products for /month/...' infobox that shows up right in the middle of the index page. I tried pasting this in: <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_products['specials_new_products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) ... but then it displays all the Specials prices as $0.00. It looks like it's actually doing the query for specials_new_products_price here: 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); $check_products_query = tep_db_query("select count(products_id) as count from " . TABLE_PRODUCTS . " where products_status = '1' and products_date_added > SUBDATE( now( ) , INTERVAL " . $days . " DAY )"); } 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); } But it's not diplaying the way that I have tried to get it to display. Any ideas/suggestions from anyone? I'm sure somebody has addressed this SOMEWHERE! It's a pretty obvious bug. I appreciate any help. If you can link me to another forum entry with the fix, that would be awesome too. Thanks, Dave Link to comment Share on other sites More sharing options...
♥ecartz Posted February 4, 2004 Share Posted February 4, 2004 I would try replacing IF(s.status, s.specials_new_products_price, p.products_price) as products_price with p.products_price, s.specials_new_products_price in both queries (one in the if; one in the else). Note: you still may have to add logic to not show the specials price if it's 0 (i.e. if there is no special price). The original code was written such that it should have shown the specials price *or* the regular price, depending if there was a special or not. Either would have appeared under products_price (the code says if s.status, use s.specials_new_products_price as the products_price; otherwise, use p.products_price). Hth, Matt Always back up before making changes. Link to comment Share on other sites More sharing options...
supergrizz Posted February 4, 2004 Author Share Posted February 4, 2004 ecartz!!! Thank you so much! That totally worked... May consider adding this as a contribution or editing the file in CVS. That's a huge fix that's actually really simple. About that logic for products with no special price, I'm sure I could copy n paste from another infobox, no doubt? Thanks again, dc Link to comment Share on other sites More sharing options...
supergrizz Posted February 4, 2004 Author Share Posted February 4, 2004 OK ... done!! After your fix, all I did to install the logic to only display price if there is no special is replace this: while ($new_products = tep_db_fetch_array($new_products_query)) { $new_products['products_name'] = tep_get_products_name($new_products['products_id']); $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="33%" valign="top"', '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><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_products['specials_new_products_price'], tep_get_tax_rate($new_products['products_tax_class_id']))); with this: while ($new_products = tep_db_fetch_array($new_products_query)) { if (tep_not_null($new_products['specials_new_products_price'])) { $lc_text = ' <s>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_products['specials_new_products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</span> '; } else { $lc_text = ' ' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . ' '; } $new_products['products_name'] = tep_get_products_name($new_products['products_id']); $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="33%" valign="top"', '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>' . $lc_text); Hope this helps everyone who was as frustrated as I was with this! Thanks again ecartz for your help. Cheers, DC Link to comment Share on other sites More sharing options...
supergrizz Posted February 4, 2004 Author Share Posted February 4, 2004 ok... one last thing. :P you must replace this: if (tep_not_null($new_products['specials_new_products_price'])) with this: if (tep_get_products_special_price($new_products['products_id'])) ... in order for it to work. I just started playing around with turning the specials on and off and discovered it still was not toggling on and off. Cheers, DC Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.