Results 1 to 10 of 10
  1. #1
    Join Date
    Feb 2005
    Location
    Italy
    Posts
    199
    Plugin Contributions
    0

    Default order total different from cart total

    Situation:

    No taxes used

    Product Price: 5.60 discounted to 3.348

    It show up at 3.35 with 2.26 discount (first error. It should be 3.35 with 2.25 discount)

    If you buy 8 of this product, the cart show a total of 26.80

    If you check out, at step 2, order total show 26.78

    It seems that this comes from the change in includes/classes/order.php occurred from 1.5.0 to 1.5.1 (around line 573)

    Not investigated the rounding error in the price showing in product page (I gues it will be in listing too).
    Paolo De Dionigi
    Co-maintainer of Zen Cart Italia

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: order total different from cart total

    What are you using to discount the Product from 5.60 to 3.348 ... there are quite a few ways that discounts things ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Feb 2005
    Location
    Italy
    Posts
    199
    Plugin Contributions
    0

    Default Re: order total different from cart total

    Hi Linda, Catalog->Specials, new price (not using percentage).
    Paolo De Dionigi
    Co-maintainer of Zen Cart Italia

  4. #4
    Join Date
    Jun 2003
    Location
    Newcastle UK
    Posts
    2,896
    Blog Entries
    2
    Plugin Contributions
    2

    Default Re: order total different from cart total

    Hi,

    Please see

    https://github.com/zencart/zencart/c...a8feb91d14c8dc

    to see if that helps.

    Note there is also
    https://github.com/zencart/zencart/c...bfedf4a342d0de
    but that just fixes the fact that I hardcoded the rounding in the initial fix.

  5. #5
    Join Date
    Jan 2005
    Location
    Como - Italia
    Posts
    3
    Plugin Contributions
    0

    Default Re: order total different from cart total

    Hi Wilt,
    we applied the mod you wrote for s_p_ike and in his case it works but now we have another problem.
    The mod works if Zen Cart makes approximation by excess, for example 3.348 that becomes 3.35
    We have another case: we need to have Products Price (Gross) equal to 50 euro so we wrote 50 in Products Price (Gross) field and we selected Italian vat from Tax Class dropdown menu in order to have our Products Price (Net).
    Italian vat is equal to 21% so we have:
    Products Price (Gross) = 50 euro
    Tax class = 21%
    Products Price (Net) = 41.3223 euro
    When we put 4 pieces of this product in cart it shows a total of 200 euro but If we check out, at step 2, order total shows 199.99 due to 41.32 x 4 plus vat = 199.9888 euro = 199.99

    The problem is the approximation by defect.
    Thank you ;-)
    Staff Zen Cart Italia since 2004.

  6. #6
    Join Date
    Jun 2003
    Location
    Newcastle UK
    Posts
    2,896
    Blog Entries
    2
    Plugin Contributions
    2

    Default Re: order total different from cart total

    Hi

    I'm assuming here that you have DISPLAY_PRICE_WITH_TAX = 'true'

    Seems the tax calculation re-introduces the rounding bug.

    I'm testing a fix at the moment, and while I have not yet promoted it to github, heres a git patch.

    Code:
    From b83f21bd295c0a8ebf31bbc8efdea9d8f5907253 Mon Sep 17 00:00:00 2001
    Date: Fri, 23 Nov 2012 21:47:12 +0000
    Subject: [PATCH] CHANGE-399 - order total different from cart total
    
    Adjust previous fix to take account of DISPLAY_PRICE_WITH_TAX
    ---
     includes/classes/order.php |    9 ++++++++-
     1 file changed, 8 insertions(+), 1 deletion(-)
    
    diff --git a/includes/classes/order.php b/includes/classes/order.php
    index 39b76bc..2023db6 100644
    --- a/includes/classes/order.php
    +++ b/includes/classes/order.php
    @@ -439,13 +439,20 @@ class order extends base {
             $rowClass="rowOdd";
           }
           $taxRates = zen_get_multiple_tax_rates($products[$i]['tax_class_id'], $taxCountryId, $taxZoneId);
    +      if (DISPLAY_PRICE_WITH_TAX == 'true')
    +      {
    +       $finalPrice = $products[$i]['price'] + $_SESSION['cart']->attributes_price($products[$i]['id']);
    +      } else 
    +      {
    +       $finalPrice = zen_round($products[$i]['price'] + $_SESSION['cart']->attributes_price($products[$i]['id']), $decimals);
    +      }
           $this->products[$index] = array('qty' => $products[$i]['quantity'],
                                           'name' => $products[$i]['name'],
                                           'model' => $products[$i]['model'],
                                           'tax_groups'=>$taxRates,
                                           'tax_description' => zen_get_tax_description($products[$i]['tax_class_id'], $taxCountryId, $taxZoneId),
                                           'price' => $products[$i]['price'],
    -                                      'final_price' => zen_round($products[$i]['price'] + $_SESSION['cart']->attributes_price($products[$i]['id']), $decimals),
    +                                      'final_price' => $finalPrice,
                                           'onetime_charges' => $_SESSION['cart']->attributes_price_onetime_charges($products[$i]['id'], $products[$i]['quantity']),
                                           'weight' => $products[$i]['weight'],
                                           'products_priced_by_attribute' => $products[$i]['products_priced_by_attribute'],
    -- 
    1.7.10.4
    Edit
    Our CI server just returned results, and the patch above does not seem to break our current tests.
    Thats not to say it doesn't break something we are not testing for though :)
    Last edited by wilt; 23 Nov 2012 at 11:57 PM.

  7. #7
    Join Date
    Jan 2005
    Location
    Como - Italia
    Posts
    3
    Plugin Contributions
    0

    Default Re: order total different from cart total

    Hi Wilt,
    sorry for the delay but we were testing and these are the results:

    in the previous case we have
    DISPLAY_PRICE_WITH_TAX = 'true'
    Tax class = 21%
    and after your mod everything is ok, we have 200 euro.

    Then we changed some values:
    With DISPLAY_PRICE_WITH_TAX = 'true'
    Tax class = none
    product price gross = product price net = 3.348 euro
    We added 8 pieces of this product in cart, as s_p_ike wrote before.
    Result: in the shopping cart page it shows a subtotal of 26.80 euro while if we check out, at step 2, subtotal shows 26.78 euro.


    With DISPLAY_PRICE_WITH_TAX = 'false'
    Tax class = none
    product price gross = product price net = 3.348 euro
    We added 8 pieces of this product in cart.
    Result: everywhere (shopping cart page and at step 2) we have a subtotal of 26,80 euro, and it is correct.

    With DISPLAY_PRICE_WITH_TAX = 'false'
    Tax class = 21%
    product price gross = 4.0511 euro
    product price net = 3.348 euro
    We added 8 pieces of this product in cart.
    Result: everywhere (shopping cart page and at step 2) we have a subtotal of 26,80 euro and it is correct.

    Best regards
    Staff Zen Cart Italia since 2004.

  8. #8
    Join Date
    Jun 2003
    Location
    Newcastle UK
    Posts
    2,896
    Blog Entries
    2
    Plugin Contributions
    2

    Default Re: order total different from cart total

    Hi,

    I made a slight adjustment to previous code fix


    PHP Code:
    -      if (DISPLAY_PRICE_WITH_TAX == 'true')
    +      
    +      if (
    DISPLAY_PRICE_WITH_TAX == 'true' && $products[$i]['tax_class_id'] != 0)
           { 

  9. #9
    Join Date
    Jan 2005
    Location
    Como - Italia
    Posts
    3
    Plugin Contributions
    0

    Default Re: order total different from cart total

    Hi Wilt,
    now the case DISPLAY_PRICE_WITH_TAX = 'true' and Tax class = none is correct, thank you!

    We tested the other cases again but now there is an error when we have:
    DISPLAY_PRICE_WITH_TAX = 'true'
    Tax class = 21%
    product price net = 3.348 euro
    product price gross = 4.0511 euro
    We added 8 pieces of this product in cart.
    Result: in the shopping cart page it shows a subtotal of 32.40 euro while if we check out, at step 2, subtotal shows 32.41 euro.

    Best regards
    Staff Zen Cart Italia since 2004.

  10. #10
    Join Date
    Jun 2003
    Location
    Newcastle UK
    Posts
    2,896
    Blog Entries
    2
    Plugin Contributions
    2

    Default Re: order total different from cart total

    Hi,

    The problem is that the changes here are really just band aids against a deeper problem with the way the order class calculates the taxes.

    I'm currently working on refactoring that, and things are looking good so far.

    Will let you know when I'm done

 

 

Similar Threads

  1. Help with Cart total / order sub total
    By philip937 in forum General Questions
    Replies: 3
    Last Post: 19 Dec 2012, 11:46 AM
  2. v151 Order Total Currency different from Order Currency
    By diego.s.v in forum Managing Customers and Orders
    Replies: 0
    Last Post: 19 Dec 2012, 01:53 AM
  3. Zencart order total does not match total at monsterpay
    By momoftwo in forum Addon Payment Modules
    Replies: 1
    Last Post: 12 Mar 2010, 02:33 PM
  4. I want an order-total module to display total w/o tax
    By ivanc in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 4
    Last Post: 31 Oct 2009, 12:11 PM
  5. 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

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