ShaGGy Posted December 29, 2011 Posted December 29, 2011 I have installed Quantity Price Breaks http://addons.oscommerce.com/info/8040 for 2.3.1 and all went fine, then i changed the Product_listing.php for a one from 2.3.1 as the one in the contrib had the OLD 2007 version. everything is working fine then I add a quantity box into the product listing page which works as it should but now I have a weird problem that I cannot find a solution too. What happens is when I ADD an item to the cart from product_listing the price displayed in product_listing becomes ZERO (the correct price is shown in the cart and checkout) it just loses the price on any item that is in the cart but only on the Product_listing page, if i add a second of the item in the cart (now showing £0.00 on product listing) it adds to the cart at the correct price? So basically the price displayed in Product listing is correct until I had the item to cart which results in the displayed price becoming ZERO (but only what is displayed on screen as it carries the correct price to the cart if added) if I remove the item from the cart the price displayed on product list reverts back to what it should be. I have checked all my currency settings etc are correct (besides it works okay from product_info). Here is the code i have inserted into product_listing.php $no_of_listings = tep_db_num_rows($listing_query); while ($_listing = tep_db_fetch_array($listing_query)) { $_listing['discount_categories_id'] = NULL; $listing[] = $_listing; $list_of_prdct_ids[] = $_listing['products_id']; } $list_of_prdct_ids = array_unique($list_of_prdct_ids); $price_breaks_query = tep_db_query("select products_id, products_special_price_2, products_qty from " . TABLE_PRODUCTS . " where products_id in (" . implode(',', $list_of_prdct_ids) . ") order by products_id, products_qty"); while ($price_break = tep_db_fetch_array($price_breaks_query)) { $price_breaks_array[$price_break['products_id']][] = array('products_price' => $price_break['products_special_price_2'], 'products_qty' => $price_break['products_qty']); } $discount_category_query = tep_db_query("select p.products_id, p.products_quantity, p.products_weight, discount_categories_id from " . TABLE_PRODUCTS ." p left join " . TABLE_PRODUCTS_TO_DISCOUNT_CATEGORIES . " using(products_id) where p.products_id in (" . implode(',', $list_of_prdct_ids) . ")"); while ($dc_array = tep_db_fetch_array($discount_category_query)) { $discount_categories[] = array ('products_id' => $dc_array['products_id'], 'products_quantity' => $dc_array['products_quantity'], 'products_weight' => $dc_array['products_weight'], 'discount_categories_id' => $dc_array['discount_categories_id']); } for ($x = 0; $x < $no_of_listings; $x++) { // add discount categories to the listing array if(!empty($discount_categories)) { for ($i = 0; $i < count($discount_categories); $i++) { if ($listing[$x]['products_id'] == $discount_categories[$i]['products_id'] ) { $listing[$x]['discount_categories_id'] = $discount_categories[$i]['discount_categories_id']; $listing[$x]['products_quantity'] = $discount_categories[$i]['products_quantity']; $listing[$x]['products_weight'] = $discount_categories[$i]['products_weight']; } } } // end if(!empty($discount_categories) } // while ($listing = tep_db_fetch_array($listing_query)) { (was original code) for ($x = 0; $x < $no_of_listings; $x++) { $rows++; Code for displaying price in Product Listing case 'PRODUCT_LIST_PRICE': $price_breaks_from_listing = array(); if (isset($price_breaks_array[$listing[$x]['products_id']])) { $price_breaks_from_listing = $price_breaks_array[$listing[$x]['products_id']]; } if (tep_not_null($listing[$x]['specials_new_products_price'])) { $prod_list_contents .= ' <td align="left"><del>' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</del> <span class="productSpecialPrice">' . $currencies->display_price($listing[$x]['specials_new_products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</span></td>'; } else { $pf->loadProduct($listing[$x]['products_id'], $languages_id, $listing[$x], $price_breaks_from_listing); $prod_list_contents .= ' <td align="right">' . $pf->getPriceStringshort() . '</td>'; } break; and for the button case 'PRODUCT_LIST_BUY_NOW': $prod_list_contents .= ' <td align="center">' . tep_draw_form('buy_now',tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'products_id')) . 'action=buy_now&products_id='. $listing[$x]['products_id']), 'POST') . '<input type="text" name="cart_quantity" value="1" maxlength="4" size="4">' . tep_draw_hidden_field('products_id', $listing[$x]['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary') . '</form></td>'; break; Hope someone can help solve this as I am ripping my air out over it
kieran_mullen Posted January 30, 2012 Posted January 30, 2012 Any fix? I have seen this error many times without any resolution. Perhaps it has to do with the forum having messaging off by defaults?
♥14steve14 Posted January 31, 2012 Posted January 31, 2012 If iot was all working before you added the quantity box, remove this part of the code. You then need to check the changes you made to install this add on. if it was working fine before, it has to be something you have changed. REMEMBER BACKUP, BACKUP AND BACKUP
Recommended Posts
Archived
This topic is now archived and is closed to further replies.