elund Posted December 8, 2009 Share Posted December 8, 2009 Unit price printed without taxes are wrong when using quantity discountAttached please find an example from an invoice:"U. price" is wrong => "Total products" (tax excl. and incl.) are wrong.But "Total with Tax" are correct"U. price" should be 400 DKK and not 390 DKK. Tax are 25%.This error also appear in the Back Office in order details etc.I don't know when this error has arised for the first time.Maybe after I upgraded to version 1.2.1.0.Where or in which files do I have to look to correct this error? Link to comment Share on other sites More sharing options...
elund Posted December 10, 2009 Author Share Posted December 10, 2009 OK, it looks definitely like there is a bug in the Prestashop code.In the table ps_order_detail product_price is stored without tax and product_quantity_discount is stored with tax.That's a mess or a lack of conceptual integrity (doing the same thing the same way).You can/will get an error in the code below (from product.php) public static function getPriceStatic(...) { . . . // Quantity discount if ($quantity > 1 AND ($qtyD = QuantityDiscount::getDiscountFromQuantity($id_product, $quantity))) { $price -= QuantityDiscount::getValue($price, $qtyD->id_discount_type, $qtyD->value); } . . . } because $price can either be with tax or without tax while quantity discount is always with tax. Link to comment Share on other sites More sharing options...
varod Posted February 7, 2010 Share Posted February 7, 2010 I still have this bug.I don't understand how to resolve it ? When I look in my Product.php, I have : // Quantity discount if ($quantity > 1 AND ($qtyD = QuantityDiscount::getDiscountFromQuantity($id_product, $quantity))) { $discount_qty_price = QuantityDiscount::getValue($price, $qtyD->id_discount_type, $qtyD->value) ; $price -= $discount_qty_price; } Which is similar as yours.What have I to change in my code to have this working well ?Thanks. Link to comment Share on other sites More sharing options...
elund Posted February 7, 2010 Author Share Posted February 7, 2010 I have changed my code to: // Quantity discount if ($quantity > 1 AND ($qtyD = QuantityDiscount::getDiscountFromQuantity($id_product, $quantity))) { if (!$usetax) $qtyD->value *= (1 / (1 + ($tax / 100))); $price -= QuantityDiscount::getValue($price, $qtyD->id_discount_type, $qtyD->value); } Link to comment Share on other sites More sharing options...
varod Posted February 7, 2010 Share Posted February 7, 2010 Wonderful ! It works now. Thank you very much ! Link to comment Share on other sites More sharing options...
elund Posted February 7, 2010 Author Share Posted February 7, 2010 You're welcome. I am happy that I was able to help you :-) Link to comment Share on other sites More sharing options...
impactpro Posted May 5, 2010 Share Posted May 5, 2010 thanks elund...had the same problem Link to comment Share on other sites More sharing options...
jeroendielemans Posted July 15, 2010 Share Posted July 15, 2010 Great solutuion.. I think...But what do I do with 1.3.1? Link to comment Share on other sites More sharing options...
elund Posted July 15, 2010 Author Share Posted July 15, 2010 Do you have the same problem?I thought it was fixed in version 1.3.1? Link to comment Share on other sites More sharing options...
jeroendielemans Posted July 15, 2010 Share Posted July 15, 2010 I have the following problem:I have my shop running now, but when I add a discount of 10 euro’s (quantity discount on 10 pieces or more), it will actually appear in the frontoffice as 8,40.The tax over here is 19 percent, and thats why it’s showing that strange amount!Because 8,40 + 19% = 10 euros!!!So the backoffice thinks I’m adding a discount of which the tax is already included or something!What I want is just give a discount of 10 euros (when the customer buys 10) on the standardprice without tax.The tax will be calculated later on in the cart…Someone please help, because I’m losing it!!! Link to comment Share on other sites More sharing options...
elund Posted July 15, 2010 Author Share Posted July 15, 2010 Hmm...???I am using version 1.3.0.10 in another shop and your example works fine there. Link to comment Share on other sites More sharing options...
jeroendielemans Posted July 15, 2010 Share Posted July 15, 2010 Well congrats elund, you're the only one then haha!Can I have your sourcefiles, then I can make a lot of people happy:D Link to comment Share on other sites More sharing options...
elund Posted July 15, 2010 Author Share Posted July 15, 2010 Are you sarcastic?Maybe I have not understand your problem correctly?(Your problem is not the same as the origin subject of this topic.)Can you find any errors at http://www.brygkunst.dk/lang-en/16-smagekasse.html regarding quantity discount? Link to comment Share on other sites More sharing options...
jeroendielemans Posted July 16, 2010 Share Posted July 16, 2010 Are you sarcastic?Maybe I have not understand your problem correctly?(Your problem is not the same as the origin subject of this topic.)Can you find any errors at http://www.brygkunst.dk/lang-en/16-smagekasse.html regarding quantity discount? Nothing personal Elund, I appreciate you trying to help!!!My problem is not the same as the origin subject indeed, but I think it is related...The problem is that I can fill in an amount in the backoffice/quantity discounts, which is going to be subtracted from the unit price when a specified amount of products is being ordered.So far so good.BUT: let;s say I fill in an amount of 10 euros when the customer is buying 10 units.What I want the system to do is this:Product price is 100 euro. (ex. Tax)Discount is 10 euro when buying minimum of 10100-10= 90 eurosPrice for product is 90 euros (ex tax) per unit when buying 10.But the system does this:Product 100 (ex tax)Discount 10 (WITH TAX)!! so it calculates it down to 8,40My unit price will then be: 91,60 instead of 90.Thats the problem, and I cant imagine there are people who really think this is a normal system behaviour!!!I already lost my job on this one, but I am still want to solve this PROBLEM Link to comment Share on other sites More sharing options...
elund Posted July 16, 2010 Author Share Posted July 16, 2010 Are you showing prices ex. VAT for customers in your country?In Denmark you must show the prices incl. VAT.From that point of view I think that PrestaShop has normal system behavior.Example:I have a product that costs 125 DKK incl. VATIf I want to give the customers 25 DKK in quantity discount,I think everybody will expect the unit price to become 100 DKK incl. VAT.So I think it is logical that the value you have to enter for quantity discount is incl VAT.(You expect it to be excl. VAT.)Sorry, I don't see any bug here ;-) Link to comment Share on other sites More sharing options...
jeroendielemans Posted July 19, 2010 Share Posted July 19, 2010 Since you put it that way...But in the Netherlands and various other countries showing price without VAT is actually normal.Here in the Netherlands wholesale and companies who work for other companies work with prices without VAT, this is legal and the most common thing to do.Thats why I find it very weird that you can't actually SET the options. So that you can turn the VAT on or off with the discount.Is there anyone out there who has any idea to remove the pre-tax on the discount? 1 Link to comment Share on other sites More sharing options...
jamiedevine Posted May 30, 2014 Share Posted May 30, 2014 We're having this exact same issue. We also have a site that does not display prices with VAT and the quantity discounts are being miscalculated. I can't find the code that PrestaShop uses to calculate the quantity discounts for products at the checkout - does anyone know where I can find this? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now