Page 1 of 3 123 LastLast
Results 1 to 10 of 23
  1. #1
    Join Date
    Oct 2010
    Posts
    84
    Plugin Contributions
    2

    Default Errors in sub total.

    Hey Guys,

    I'm having a little trouble with the subtotal being slighty wrong and would like to know if someone could point me in the right direction.

    Basicly it seems as if the subtotal is always out by a few pence. Here's an example ...


    This is a breakdown of the total goods sold. I wont bother with the product details or the amount as this all ads up its just the subtotal.

    6.70
    59.94
    22.92
    33.84
    15.16

    total = 138.56

    But the subtotal everywhere is 138.53 ?

    Is this a rounding error ? I don't know but if someone could just even point me to where the sub total is being calculated that would be great I don't know if its a function or being accumulated from the individual products price but its a real head scratcher.

    The only reason I am really bothered is at the company that I work they have a stock control system and this data needs to be exported out as a CSV and into there stock control system to deduct stock and generate customer invoices etc but the software programmer of the stock control system is being really funny about how things adds up and has coded the importer to reject bad maths lol

    Any help at all would be much appreciated.

  2. #2
    Join Date
    Feb 2005
    Location
    Lansing, Michigan USA
    Posts
    20,021
    Plugin Contributions
    3

    Default Re: Errors in sub total.

    What version of Zencart ? There was a rounding error fix in 1.3.9e.

  3. #3
    Join Date
    Oct 2010
    Posts
    84
    Plugin Contributions
    2

    Default Re: Errors in sub total.

    It's 1.39g I think but there is quite a few mods installed and I have been known to just take the easy route and overwrite files lol is there a changelog or something I can look up the fix and patch the site up ?

  4. #4
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: Errors in sub total.

    Quote Originally Posted by drgr33n View Post
    there is quite a few mods installed and I have been known to just take the easy route and overwrite files lol
    not really something to "lol" about.
    Quote Originally Posted by drgr33n View Post
    is there a changelog or something I can look up the fix and patch the site up ?
    If you're blindly replacing files willy-nilly, then a changelog isn't likely to serve its intended purpose.
    Nevertheless, if you look in the /docs/ folder of your site files you'll see the documentation about what's changed between releases and the files involved.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Oct 2010
    Posts
    84
    Plugin Contributions
    2

    Default Re: Errors in sub total.

    I know i was a bit stupid. Ok well thanks for your help.
    Last edited by drgr33n; 1 Dec 2010 at 10:26 PM.

  6. #6
    Join Date
    Oct 2010
    Posts
    84
    Plugin Contributions
    2

    Default Re: Errors in sub total.

    I can't seem to find info about the rounding error fix in 1.39e ? I found a bug fix related to PAYPAY shipping tax but thats it. Does anyone have the bugforum reference number ?

  7. #7
    Join Date
    Oct 2010
    Posts
    84
    Plugin Contributions
    2

    Default Re: Errors in sub total.

    Well I've been through all the changes made in 1.3.9e and it seems as all my files are up to the current version of zen cart but I'm still getting this rounding error ? If I disable tax from our store everything adds up but if I turn tax on I'm getting a few pence out on the subtotal ?

  8. #8
    Join Date
    Oct 2010
    Posts
    84
    Plugin Contributions
    2

    Default Re: Errors in sub total.

    Well I've been on this one all day and still can't figure it out I've pin pointed it to a rounding error.

    I think whats happening is that when the tax is added on each individual price and then rounded the prices are missing the odd half pence here and there. And when I add up the individual prices and then compare this to the subtotal its always going to be a few pence out due to this.

    I think the best way for me to proceed is to change the way zen cart calculates the subtotal by adding the tax to each individual product and then adding all the rounded figures together to come up with the sub total ?

    Could someone point me to the function / module that's responsible for calculating the total ?
    Last edited by drgr33n; 6 Dec 2010 at 02:48 PM.

  9. #9
    Join Date
    Jul 2008
    Posts
    29
    Plugin Contributions
    0

    Default Re: Errors in sub total.

    I've been experiencing a rounding problem since 1.39d (problem may have existed before but hadn't noticed).

    I can assure you that the problem still eists after 1.39e. I am running 1.39g right now and the problem persists.

    It only happens when I have quantity discounts (expressed as a percentage).

    For example I have a product (Polarized Header 4 Pin Female) which sells for $0.31 each or $0.28 each for 10 or more.

    I had an order the other day which had

    64 x Polarized Header 4 Pin Female $17.92
    =====
    Subtotal $17.86
    Freight $5.00
    Freight Insurance $0.89
    =====
    Total $23.75

    The quantity discount on the product is expressed as a percentage (10%) and it so happens that 64 * 0.31 * .9 = 17.856.

    The way it used to work (1.38x) was the subtotal = sum (qty * round(price*(1 -discount/100))) but now it seems like round(sum(qty * (1-discount/100)))

    Daniel.

  10. #10
    Join Date
    Aug 2009
    Posts
    50
    Plugin Contributions
    0

    Default Re: Errors in sub total.

    I have the same error

    Product 1 - price 10.50 - discount 15% - 8.93
    Product 2 - price 11 - discount 15% - 9.35
    Subtotal - 18.27 (instead of 18.28)

    It seems an error in round .xx5

    I have version 1.3.9h

    And yes with 1.3.8x this problem was not present

    Any idea how to fix it?
    Last edited by incircolo; 20 Oct 2011 at 02:06 PM.

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. v152 Incorrect Sub-total and Total amount during checkout_payment page
    By ZkullGraveAce in forum General Questions
    Replies: 4
    Last Post: 10 Jan 2014, 02:45 AM
  2. Help with Cart total / order sub total
    By philip937 in forum General Questions
    Replies: 3
    Last Post: 19 Dec 2012, 11:46 AM
  3. Sub-total and total price are the same, please help!
    By albertvn in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 5 Jan 2010, 02:13 AM
  4. Sub Total not matching actual total of products in order
    By PadreHomer in forum General Questions
    Replies: 0
    Last Post: 10 Sep 2008, 11:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg