luca.lb Posted February 25, 2010 Share Posted February 25, 2010 I've find this big BUG.If you add to cart a product with discount quantity, the taxes are calculate from the price without the discount.For exemple:Ipod 100€ (tax included), and for 10pz apply 50€ of discount to product (tax included??!?!?).If I add 20 ipod in my cart, the total price of Ipods is (100€-50€)*20=1000€ (tax included)In the cart I've this total report (tax 19.6%, prestashop 1.2.5 and 1.3.0.1):The cart summary report:Total products (tax incl.): 1 000,00 €Total (tax excl.): 672,24 € WRONG!!! is calculed from prices without discount: 2000€ and not 1000€Total tax: 327,76 € WRONG!!! is the tax of prices without discount. Calculaed from 2000€ and not 1000€Total (tax incl.): 1 000,00 € The amount of taxes is calculated without discount into account the quantity discount Link to comment Share on other sites More sharing options...
bambi Posted March 10, 2010 Share Posted March 10, 2010 Hi luca.lbHave the same problem...Did you find a solution?Cheers :-) Link to comment Share on other sites More sharing options...
luca.lb Posted March 10, 2010 Author Share Posted March 10, 2010 Hi luca.lbHave the same problem...Did you find a solution?Cheers :-) I've open the bug report, and the staff as been resolved it in new 1.3 beta version. Link to comment Share on other sites More sharing options...
bambi Posted March 10, 2010 Share Posted March 10, 2010 I have had problems with PayPal module not rounding prices. I have made the changes tomerg suggested, may be that has to do with the dicount errors.Guess we have to wait til PS 1.3 becomes stabel... :roll: Link to comment Share on other sites More sharing options...
kavin86 Posted March 12, 2010 Share Posted March 12, 2010 Hi, i have the 1.2.5 version, i have the same problem. Wich file are interested??Thanks Link to comment Share on other sites More sharing options...
badger1010 Posted May 17, 2010 Share Posted May 17, 2010 I've found if you use the discount By Amount, the tax is calculated incorrectly as described above by luca.lb.However, if you use By %, the tax appears to be calculated correctly.So it is possible to offer discounts, just use the By %. :ohh: Link to comment Share on other sites More sharing options...
jeroendielemans Posted June 11, 2010 Share Posted June 11, 2010 So it is possible to offer discounts, just use the By %. Wont work because the discountmodule always rounding the amount... There has to be a solution, can someone tell me how to do this?I can't upgrade to 1.3 because I modded my prestashop too much, I think it will give some errors then... Link to comment Share on other sites More sharing options...
jeroendielemans Posted June 16, 2010 Share Posted June 16, 2010 I have some great news for you!Member Rocky had the solution!Check it out below: PrestaShop v1.3.1 includes security updates, so you really should upgrade, or at least apply the security fixes to your PrestaShop v1.2.5 installation.I had a look at the bug report and luckily, Bruno explained how he fixed the problem. Try changing lines 1279-1281 of classes/Product.php from: // Quantity discount if ($quantity > 1 AND ($qtyD = QuantityDiscount::getDiscountFromQuantity($id_product, $quantity))) $price -= QuantityDiscount::getValue($price, $qtyD->id_discount_type, $qtyD->value); to: if (intval($id_cart)) // Quantity discount { $totalQuantity = intval(Db::getInstance()->getValue(' SELECT SUM(`quantity`) FROM `'._DB_PREFIX_.'cart_product` WHERE `id_product` = '.intval($id_product).' AND `id_cart` = '.intval($id_cart)) ) + intval($quantity); } if ($quantity > 1 AND ($qtyD = QuantityDiscount::getDiscountFromQuantity($id_product, $quantity))) { $discount_qty_price = QuantityDiscount::getValue($price, $qtyD->id_discount_type, $qtyD->value, $usetax, floatval($result['rate'])); $price -= $discount_qty_price; } and lines 50-60 of classes/QuantityDiscount.php from: public static function getValue($product_price, $id_discount_type, $value) { if ($id_discount_type == 1) { $percentage = $value / 100; return $percentage * floatval($product_price); } elseif ($id_discount_type == 2) return $value; return 0; } to: public static function getValue($product_price, $id_discount_type, $value, $usetax = true, $taxrate = 1) { if ($id_discount_type == 1) { $percentage = $value / 100; return $percentage * floatval($product_price); } elseif ($id_discount_type == 2) return !$usetax ? ($value / (1 + ($taxrate / 100))) : $value; return 0; } Link to comment Share on other sites More sharing options...
Recommended Posts