Jump to content

Recommended Posts

Hi Just posted this on the bug tracker - I woudl love it if anyone could help me with this error

Has anyone esle read it, or had a similar experience?



Basically the issue that I have is that when the pdf for the order is generated, any item that has had a discount subtracted kicks an incorrect SECOND subtotal.

The invoice breakdown::

1: Total (tax excl.) - this is correct and has had the discount subtracted (i.e. £10.00 off per 5 items etc)
2: Total (tax incl.) - this again is correct and has had the current VAT rate (17.5%) added on to the discounted total
3: Shipping (if applies) this is the amount of shipping - if there is no shipping, then this doesn't appear.
4: Final subtotal - if there is shipping, then then this final subtotal is the tax incl. plus the shipping. Despite the fact that this looks confusing having 2 subtotals if there is no shipping, *IT IS WRONG*. The second total that

shows is the tax incl. BEFORE the discount has been taken off, so there are 2 different subtotals and the latter is incorrect.

*Please see included example*

On the attached jpg, you can see the 2 subtotals are wrong - there is no shipping to be added on hence there is no shipping on the PDF (even though in my opinion it should say 'shipping = £0.00'). On this test buy I have bought 12 items

making it eligible for a £2.51 discount per item - which has been subtracted form the first subtotal :: £461.00 so -

The items pre-tax retail is £40.96.

I have bought 12 of these in my test buy - this means that this £40.96 will get £2.51 subtracted from each one, so the new pre-tax retail will be £38.45...this means that the re-tax retail is::

38.45 * 12 = 461.40 (£461.40 = this is bang on )

ADD TAX = (17.5%)

461.40 * 1.175 = 542.16 (£542.16 = prestashop is 1 out on the second decimal place (0.01), but this is not the real issue)

--NO SHIPPING ADDED-- this is correct
So the second subtotal with tax on the pdf says - £547.42.

Subtract mine from this - 547.42 - 542.16 = 5.26 ... £5.26 difference.

--I worked this out as -

Take the 2.51 discount - multiply this by 12 to get the gross discount and add Tax to it -

2.51 * 12 = 30.12

(30.12 / 100) * 17.5 = 5.27 (0.01 out here - strange maybe we're rounding something different)

-- I tried my theory on a few different items with discounts and it seems to hold up.

Pretty serious error in my opinion and I would find it hard to believe that nobody else has noticed it - but I can't find anything in the forum.

I would please like some confirmation that I am correct - I think the PDF id a bit crappy anyways, but I'm not keen on editing the code unless a moderator can confirm and suggest.

Maybe this is a really simple error - or somebody has already fixed it?!

I look forward to some help and guidance.


Share this post

Link to post
Share on other sites
  • 3 weeks later...
  • 3 weeks later...

Fixed - after a hell of a lot of frusration and calculations, I manageed to sort it.... I can't remember what line it was on, but I simply located the relevant variables and made sure that I only applied VAT or TAX to the discounted total - NOT the original total.

Still no real closure here though and not a word from an admin... I reported this to the bug tracker and it has been in the forum a while now with no real resolve.

Share this post

Link to post
Share on other sites
...I can't remember what line it was on...

Alôrs là ca devient intéressant! Mais quelle dommâge, qu'il ne souvient pas ce qu'il avait fait :(
I hope you'll share the information when you find out which line it was.

Share this post

Link to post
Share on other sites

Hmm - I can't remember exactly what I did - but it wasnt really a substantial error, the cart equations are correct, it just references a wrong var when it writes the PDF.

I have enclosed my pdf class file so you can either use it or examine (i think this is the correct one).

Let me know how you get on.



Share this post

Link to post
Share on other sites

No, I dealt with it by deleting the last 2 lines entirely :D
I'm not going to spend time on it until the next job (my boss thinks I've other more important things to do).
But I'll surely tell you when I get the opportunity to try...

Share this post

Link to post
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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More