Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Nov 2005
    Location
    France
    Posts
    577
    Plugin Contributions
    8

    Default Admin rounding errors

    I have an issue with rounding errors in admin using version 1.5.3.
    I thought these had been resolved in 1.5 but i've just tested a completely clean install of 1.5.3 using the same tax settings as the client site and there is indeed an issue.
    Tax is set at 20%. Product price including tax is 6.99 which when entered into Products Price (Gross) on the product entry page is automatically calculated as 5.825 in the Products Price (Net) entry field. Preview page changes this to 2 decimal places making it 5.83. Tax added to 5.83 is 7.00. Tax added to 5.825 is 6.99

    The product list in admin shows the product as 7.00 as do any order pages and invoices. Store side shows the correct value of 6.99

  2. #2
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,379
    Plugin Contributions
    9

    Default Re: Admin rounding errors

    Quote Originally Posted by strelitzia View Post
    I have an issue with rounding errors in admin using version 1.5.3.
    I thought these had been resolved in 1.5 but i've just tested a completely clean install of 1.5.3 using the same tax settings as the client site and there is indeed an issue.
    Tax is set at 20%. Product price including tax is 6.99 which when entered into Products Price (Gross) on the product entry page is automatically calculated as 5.825 in the Products Price (Net) entry field. Preview page changes this to 2 decimal places making it 5.83. Tax added to 5.83 is 7.00. Tax added to 5.825 is 6.99

    The product list in admin shows the product as 7.00 as do any order pages and invoices. Store side shows the correct value of 6.99
    This thread might give you a clue: http://www.zen-cart.com/showthread.p...94#post1254894

  3. #3
    Join Date
    Nov 2005
    Location
    France
    Posts
    577
    Plugin Contributions
    8

    Default Re: Admin rounding errors

    Just looked at your thread. Interesting. I'll give your code changes a go and see if it resolves the issue.
    TBH, if this issue really has been around since 2008 it's ridiculous that a major flaw such as this has not been addressed!
    Devs, If this is the case, care to comment why this hasn't been resolved?

  4. #4
    Join Date
    Nov 2005
    Location
    France
    Posts
    577
    Plugin Contributions
    8

    Default Re: Admin rounding errors

    I made the edits listed by frank18 to a vanilla 1.5.3 and it didn't fix the admin displayed price issue so further help is going to be needed.
    The store side is showing the correct price of 6.99 but admin stubbornly shows 7.00

    Making the Net price only 2 decimal places wouldn't fix the problem as 20% tax on 5.82 is 6.984
    It will only work if it uses the full 5.825 value.
    It must be feasible as the store side can calculate it from the figure stored in the database.

  5. #5
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,379
    Plugin Contributions
    9

    Default Re: Admin rounding errors

    Quote Originally Posted by strelitzia View Post
    I made the edits listed by frank18 to a vanilla 1.5.3 and it didn't fix the admin displayed price issue so further help is going to be needed.
    The store side is showing the correct price of 6.99 but admin stubbornly shows 7.00

    Making the Net price only 2 decimal places wouldn't fix the problem as 20% tax on 5.82 is 6.984
    It will only work if it uses the full 5.825 value.
    It must be feasible as the store side can calculate it from the figure stored in the database.
    Did you also apply the change in admin/includes/functions/functions_prices.php ?

    PHP Code:
    return number_format($blah_blah_variable2'.'''); 

  6. #6
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,379
    Plugin Contributions
    9

    Default Re: Admin rounding errors

    Searching through my live 1.5.3 site I noticed that I had made one other change in admin/functions/functions_prices.php

    starting around line 90

    PHP Code:
          if (!$special_price) { 
            return 
    number_format($sale_product_price2'.'''); // number_format changed from 4 to 2 decimals - frank18 
          
    } else { 
            switch(
    $sale->fields['sale_specials_condition']){ 
              case 
    0
                return 
    number_format($sale_product_price2'.'''); 
                break; 
              case 
    1
                return 
    number_format($special_price2'.'''); 
                break; 
              case 
    2
                return 
    number_format($sale_special_price2'.'''); 
                break; 
              default: 
                return 
    number_format($special_price2'.'''); 
            } 
          } 
    Didn't think that was relevant for your purpose as it deals with specials - but worth a try in your vanilla 1.5.3 installation

  7. #7
    Join Date
    Jun 2013
    Location
    United Kingdom
    Posts
    40
    Plugin Contributions
    5

    Default Re: Admin rounding errors

    Sorry to reinvigorate an old thread, but this still ranks well for 'zen cart admin price rounding'.

    I encountered this issue today on 1.5.5, and my fix was as follows:

    In /ADMIN-DIR/includes/functions/general.php, within the zen_add_tax function, change...

    PHP Code:
    return zen_round($price$currencies->currencies[DEFAULT_CURRENCY]['decimal_places']) + zen_calculate_tax($price$tax); 
    ...to...

    PHP Code:
    return zen_round( ( $price zen_calculate_tax($price$tax) ), $currencies->currencies[DEFAULT_CURRENCY]['decimal_places'] ); 

  8. #8
    Join Date
    Apr 2017
    Location
    Netherlands
    Posts
    20
    Plugin Contributions
    0

    Default Re: Admin rounding errors

    It does not work in my 1.55e shop. I enter the amount including 21% so the price is 25,00 euro. Once I go back into the product in admin it is then updated automatically to 25.0001
    This is giving my real issues in the gift certificate I sell for 25 euro.

  9. #9
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,379
    Plugin Contributions
    9

    Default Re: Admin rounding errors

    Quote Originally Posted by bramf View Post
    It does not work in my 1.55e shop. I enter the amount including 21% so the price is 25,00 euro. Once I go back into the product in admin it is then updated automatically to 25.0001
    This is giving my real issues in the gift certificate I sell for 25 euro.
    That is only 100th of a cent out in the admin. You would need to sell 50 or more gift certs of 25 euro each to the same person in the same order for this to come into effect on your store front. Simple solution: don't worry about that 100th of a cent.

  10. #10
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Admin rounding errors

    Quote Originally Posted by frank18 View Post
    That is only 100th of a cent out in the admin. You would need to sell 50 or more gift certs of 25 euro each to the same person in the same order for this to come into effect on your store front. Simple solution: don't worry about that 100th of a cent.
    Unfortunately as reported here as a new post with more information that 100th of a cent is apparently causing the customer to lose a full cent in the transaction.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. USPS Rounding Errors -- Should never round down
    By TraderDan in forum Built-in Shipping and Payment Modules
    Replies: 20
    Last Post: 10 Aug 2009, 03:07 PM
  2. product quanitites cause VAT Rounding Errors
    By guyp in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 6 Jun 2008, 11:10 AM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR