Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-17667

Rounding Errors in shopping cart

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Medium Medium
    • None
    • 4.2.0, 4.3.0
    • Legacy > Webshop
    • None
    • Operating System: Centos 5.5
      PHP Version: (please be specific, like '4.4.3' or '5.1.5') 5.3.2
      Database and version: mySQL 5.1.51
      Browser (and version): All

    Description

      Any calculation in the shopping cart that uses a percentage, such as sales tax or discounts, produces rounding errors in the totals. Each line item is rounded to two decimal places for display in the shopping cart, but the totals are calculated using the original float values. This results in the totals not equaling the sum of the displayed line items.

      This applies to the total ext VAT in all cases and all totals if a discount is applied.

      Steps to reproduce

      If sales tax and discounts are applied to products, shopping baskets containing many 3 or 4 more items can display totals that are less than the sum of the displayed line items. due to the fact that the line items are rounded to two decimal places, but the totals are calculated from "float" values.
      eg. 3 products, price 99.99 discounted by 30%
      Price is 69.993 displayed as 69.99
      Total is 3*69.993 = 209.979, displayed as 209.98
      BUT 3*69.99 = 209.97
      So we already have an error with only 3 products in the shopping basket, as the # items increases the error can increase.

      Attachments

        Activity

          People

            unknown unknown
            richardl richardl
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: