Results 1 to 10 of 58

Hybrid View

  1. #1
    Join Date
    Jun 2008
    Location
    Japan
    Posts
    133
    Plugin Contributions
    5

    Default Re: Different Total Displayed

    Quote Originally Posted by pilou2 View Post
    ...Total is 15035, which I have no idea how it ends to this value...
    I figure this out, 15035 = 14260 + 775 (shipping fee). It is time for me to sleep...

  2. #2
    Join Date
    Apr 2008
    Location
    Qld, Australia
    Posts
    257
    Plugin Contributions
    6

    Default Re: Different Total Displayed

    From my testing with the conversion from AUD to EUR, or any other currency I have set, the display for payment information is now correct.
    Thank you Lat9
    OldNGrey
    ZC158a PHP 8.2.15
    MySQL 10.6.16-MariaDB

  3. #3
    Join Date
    Jun 2008
    Location
    Japan
    Posts
    133
    Plugin Contributions
    5

    Default Re: Different Total Displayed

    I think I figured out part of the problem. In my currency with rate 155 (JPY) I use 0 decimal. It seems that currency conversion in cart rounds to 0 decimals before conversion:
    Product price 48.34 becomes 48 which multiply by 155 gives 7440 which is exactly the wrong price I got in cart without tax.
    Second product price 35.00 has 0 as decimal. This is why price after conversion is still right. I don't know where it is in the code yet.

    When displaying prices with tax:
    Product 1: 48.34 x 1.1 = 53.174 ----> 53 x 155 = 8215 Which is what I got.
    Product 2: 35.00 x 1.1 = 38.5 ----> 39 x 155 = 6045 Which is what I got too!

    Rounding to new decimal setting should be done after conversion.

    Calculation in last checkout screen is different and there might be something else to figure out...

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

    Default Re: Different Total Displayed

    Quote Originally Posted by pilou2 View Post
    I think I figured out part of the problem. In my currency with rate 155 (JPY) I use 0 decimal. It seems that currency conversion in cart rounds to 0 decimals before conversion:
    Product price 48.34 becomes 48 which multiply by 155 gives 7440 which is exactly the wrong price I got in cart without tax.
    Second product price 35.00 has 0 as decimal. This is why price after conversion is still right. I don't know where it is in the code yet.

    When displaying prices with tax:
    Product 1: 48.34 x 1.1 = 53.174 ----> 53 x 155 = 8215 Which is what I got.
    Product 2: 35.00 x 1.1 = 38.5 ----> 39 x 155 = 6045 Which is what I got too!

    Rounding to new decimal setting should be done after conversion.

    Calculation in last checkout screen is different and there might be something else to figure out...
    Thank you for taking the time to check this out. It would help me to reproduce and then correct the issue if I could verify:

    Store currency, number of decimal digits (sounds like 2)
    What is the 1.1 that multiplies the product pricing, for example 48.34 x 1.1 = 53.174
    Store currency, converted to JPY with a 155 conversion rate.

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

    Default Re: Different Total Displayed

    Quote Originally Posted by lat9 View Post
    Thank you for taking the time to check this out. It would help me to reproduce and then correct the issue if I could verify:

    Store currency, number of decimal digits (sounds like 2)
    What is the 1.1 that multiplies the product pricing, for example 48.34 x 1.1 = 53.174
    Store currency, converted to JPY with a 155 conversion rate.

    The main currency is default US$. I use a default cart with demo data to which I added Japanese yen as currency with rate (including factor 1.05) of 155 (155.00000000) and has 0 decimal. Then I modified Tax to apply worldwide and at a 10% rate which makes it easier for debugging. Then, I modified some products prices and one is 48.3400 without tax and the other is 35.0000 without tax too.
    Now, I suppose you understand 48.34 (price w.o.t.) x 1.1 (10% tax).
    1.1 is 1 + 10/100...

    I looked at the code and find some rounding (line 118 in shopping cart header and some in shopping cart class) I can suppress to get correct prices, but then the 'one digit off' bug comes back. I think these rounding were added to correct this bug, but in fact hide it.
    Probably, the right thing to do would be to do a rounding after currency conversion (if necessary) but before any other calculation like adding tax, then a last rounding before displaying.

    I could not find where currency conversion is done for subtotals. It seems subtotal is calculated differently depending on page you are: cart, checkout payment and checkout confirmation... If you know where this currency conversion is done, please let me know.

  6. #6
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,575
    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.

  7. #7
    Join Date
    Jun 2008
    Location
    Japan
    Posts
    133
    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.

  8. #8
    Join Date
    Nov 2023
    Location
    Hounslow
    Posts
    81
    Plugin Contributions
    0

    Default Re: Different Total Displayed

    Quote Originally Posted by lat9 View Post
    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.
    Hi,

    Sorry for asking on this but. I'm just at a point in making a payment plugin, and have looked a a few other one's and am getting a mixed view on 'order's final total' that's sent to payment gateway as some are using : "$amount_total=round($order->info['total']*$order->info['currency_value'],$decimal_places)*$multiplied_by;" but to me the amount sent to the payment gateway should just be "$order->info['total']" untouched by any sort of "$order->info['currency_value']" as this in my view is dealt with for cart total, am i right on this please?
    just to let you know what "$multiplied_by" is, the "presentment currencies - Zero-decimal currencies. Three-decimal currencies ..." which are needed before sending to the gateway.

    So if currency conversion is done at cart to order point then, this
    "$amount_total=round($order->info['total']*$order->info['currency_value'],$decimal_places)"
    is just making the amount to pay bigger by currency rate of the order and not matching the displaid amount in checkout before and after payment has been taken and shown on success page?

 

 

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