Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-30069

Shopping Order total calculation always adds insurance regardless of insure flag

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Inactive
    • Affects Version/s: 6.1.1 CE GA2, 6.1.30 EE GA3, 6.2.0 CE M2, 6.2.0 CE M4
    • Fix Version/s: None
    • Component/s: Util, Util > Shopping
    • Labels:
    • Environment:
      Tomcat 7.0 + MySQL 5. Portal 6.1.x EE GIT ID: febe1fa217a5859f770442405eeb455a6c72bf3a.
      Tomcat 7.0 + MySQL 5. Portal 6.2.x GIT ID: 838cef246e57e86ae29e9d7d4e145c22c9ffb53a.
    • Fix Priority:
      3

      Description

      Related issue: LPS-30067

      Steps to recreate:

      1) Configure the shopping portlet to utilize insurance (flat rate or percentage)
      2) Add an item to the cart with > $0 value
      3) Go to Cart
      4) Do NOT add insurance from the drop down
      5) Checkout
      6) Look at saved order and the insurance break out does not show up (rightfully since the insure flag should be false and is checked in edit_order.jsp), but it is still used in the total calculation.
      7) Look at the record in the DB for that order, and the insure field is set to 0 (note that the insurance amount is set)

      This causes a few of issues:
      1) When insurance is configured, the insurance is always added to the order total when viewing the order after checkout. Note that it does not seem to be added during the check out.
      2) The insurance amount is not shown in the break out of the order total, but it is added to the total, causing possible confusion and mismatched order totals.

      The reason this is happening:
      In the com.liferay.portlet.shopping.util.ShoppingUtil.calculateTotal method, the insure flag is never checked when adding the insurance to the total, so it is added regardless of the flag (and the insurance amount is set based on the insurance configuration whether the customer selected insurance during check out or not.)

      Here is the code for reference:

      double total =
      calculateActualSubtotal(orderItems) + order.getTax() +
      order.getShipping() + order.getInsurance() -
      order.getCouponDiscount();

      Note that because of LPS-30067, the flag would be incorrect anyway!

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                4 years, 39 weeks, 6 days ago

                Packages

                Version Package