Jump to content

[SOLVED] Unit price printed without taxes are wrong when using quantity discount


Recommended Posts

Unit price printed without taxes are wrong when using quantity discount

Attached 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?

15694_zObSg4k9lqYZX4LrzAe5_t

Link to comment
Share on other sites

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

  • 1 month later...

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

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

  • 2 months later...
  • 2 months later...

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

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 10

100-10= 90 euros

Price 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,40

My 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

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. VAT
If 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

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?

  • Like 1
Link to comment
Share on other sites

  • 3 years later...

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...