Page 5 of 6 FirstFirst ... 3456 LastLast
Results 41 to 50 of 58
  1. #41
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,498
    Plugin Contributions
    88

    Default Re: Different Total Displayed

    Thanks for the quick response, @pilou2, it is much appreciated. I'm off to configure my testing site with that information and will hopefully have some idea of where the issue lies later today.

    The sub-total calculations for the shopping-cart page's display are performed by the page's header_php.php, first via call to the shopping-cart class' show_total method, with the returned value then formatted into the currently-selected currency.

    During the checkout, the subtotal calculation is performed within the order-class' cart method. The overall total and tax are further manipulated by the various order-total modules to produce the order's final tax and total.

  2. #42
    Join Date
    Jun 2008
    Location
    Japan
    Posts
    123
    Plugin Contributions
    5

    Default Re: Different Total Displayed

    Quote Originally Posted by lat9 View Post
    Thanks for the quick response, @pilou2, it is much appreciated. I'm off to configure my testing site with that information and will hopefully have some idea of where the issue lies later today.

    The sub-total calculations for the shopping-cart page's display are performed by the page's header_php.php, first via call to the shopping-cart class' show_total method, with the returned value then formatted into the currently-selected currency.

    During the checkout, the subtotal calculation is performed within the order-class' cart method. The overall total and tax are further manipulated by the various order-total modules to produce the order's final tax and total.
    Thanks, I come back here if I find something interesting.

  3. #43
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,498
    Plugin Contributions
    88

    Default Re: Different Total Displayed

    @pilou2, is the site displaying prices with tax or not?

  4. #44
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,498
    Plugin Contributions
    88

    Default Re: Different Total Displayed

    Quote Originally Posted by lat9 View Post
    @pilou2, is the site displaying prices with tax or not?
    Never mind, you have fully identified the cases in post #43 of this thread.

  5. #45
    Join Date
    Jun 2008
    Location
    Japan
    Posts
    123
    Plugin Contributions
    5

    Default Re: Different Total Displayed

    Cart page is now fixed but code still need lots of testing because of all possible discount, attributes and other free stuffs.
    I made a branch for that on my ZC fork: https://github.com/piloujp/zencart/tree/Currency-prices

    For checkout page, nothing is done yet.

  6. #46
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,498
    Plugin Contributions
    88

    Default Re: Different Total Displayed

    Yep, I'm pretty close on an overall solution that appears to work properly for the issues identified here by @todoonada, @pilou2 and @OldNGrey; I'll post back here when that Zen Cart pull-request (PR) has been updated.

  7. #47
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,498
    Plugin Contributions
    88

    Default Re: Different Total Displayed

    Quote Originally Posted by lat9 View Post
    Yep, I'm pretty close on an overall solution that appears to work properly for the issues identified here by @todoonada, @pilou2 and @OldNGrey; I'll post back here when that Zen Cart pull-request (PR) has been updated.
    PR updated. All cases reported in this thread (and a couple from clients) validated as corrected.

  8. #48
    Join Date
    Nov 2006
    Posts
    108
    Plugin Contributions
    0

    Default Re: Different Total Displayed

    Quote Originally Posted by lat9 View Post
    PR updated. All cases reported in this thread (and a couple from clients) validated as corrected.
    Hello lat9,
    thank you for the work you put into it.
    I do not have the time to test at the moment.
    I made a bit of a hack to solve the problem, so it works for me at the moment. However it is not a reasonable solution to go into main Zen Cart code.

  9. #49
    Join Date
    Jun 2008
    Location
    Japan
    Posts
    123
    Plugin Contributions
    5

    Default Re: Different Total Displayed

    Quote Originally Posted by lat9 View Post
    PR updated. All cases reported in this thread (and a couple from clients) validated as corrected.
    I tried the new PR.
    For files header.php and shopping_cart.php I did exactly the same modifications at first, and it did correct issues discussed in this thread but re-introduced an old one...
    Which is that the last digit has a one unit shift when using another currency. It appears only in total when displaying prices without tax, and it is also in subtotal when displaying prices with tax.

    Problem comes from calculation logic.
    For cart calculation, products price (in main currency) has tax added and then is being converted to new currency, all this one by one.
    In this case, all prices are rounded one by one when conversion is done.
    For subtotal or total calculation, all products prices in main currency are added then tax apply, then currency conversion.
    In this case, all products prices are added then rounding is done at conversion time.

    Unfortunately, due to rounding errors, total in both calculation can have a difference of one unit on the last digit.
    With numbers I gave you and a conversion rate of 155 and tax at 10%, I got 1 yen difference at the end.

    In cart (with tax displayed):
    48.34 x 1.1 = 53.174 x 155 = 8241.97 rounded to 8242
    35.00 x 1.1 = 38.5 x 155 = 5967.5 rounded to 5968
    -------------------------------------------------
    Total: 14210

    subtotal calculation:
    48.34 + 35.00 = 83.34 x 1.1 = 91.674 x 155 = 14209.47 rounded to 14209

    My idea to fix it, that I applied in shopping_cart.php, is to do conversion and rounding on each price before adding them, when calculating subtotal or total:
    ((48.34 x 155 = 7492.7 rounded to 7493) + (35.00 x 155 = 5425)) = 12918 x 1.1 = 14209.8 rounded to 14210

    With all possible prices modification by discounts, attributes and others it makes this modification pretty complicated...

  10. #50
    Join Date
    Jun 2008
    Location
    Japan
    Posts
    123
    Plugin Contributions
    5

    Default Re: Different Total Displayed

    I updated the GitHub branch with something that seems to do the job. https://github.com/piloujp/zencart/tree/Currency-prices
    No more penny loss, numbers add perfectly except when using a secondary currency and a shipping module with tax class, then shipping tax is missing from the total. It is included in tax or shipping cost depending on tax display option, but always missing in total...

    When using main currency, everything is perfect! If you have an idea of what is going on...

    Attributes and discount stuffs have not been tested yet.

 

 
Page 5 of 6 FirstFirst ... 3456 LastLast

Similar Threads

  1. Replies: 5
    Last Post: 3 Apr 2020, 07:53 PM
  2. v151 Site that displayed different templates.
    By Malaperth in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 3 Feb 2014, 07:38 PM
  3. v151 order total different from cart total
    By s_p_ike in forum Bug Reports
    Replies: 9
    Last Post: 9 Dec 2012, 09:29 AM
  4. Different Product Listing styles displayed
    By skelly100 in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 31 Dec 2009, 11:33 PM
  5. Free shipping for Different sales total for different zones
    By francesca_ph in forum Built-in Shipping and Payment Modules
    Replies: 20
    Last Post: 30 Dec 2008, 05:43 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