Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-5767

WebShoppingCart ignores session currency

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 12.04.04, 12.04.05
    • None
    • ecommerce
    • None

    Description

      This is how WebShoppingCart constructor calls ShoppingCart constructor:

      (currencyUom != null ? currencyUom : ProductStoreWorker.getStoreCurrencyUomId(request)),

      WebShoppingCart constructor is called only from

      getCartObject(HttpServletRequest request, Locale locale, String currencyUom)

      which is called only from

      getCartObject(HttpServletRequest request)

      with null locale and currency.
      So, during WebShoppingCart creation, currency is always set to

      ProductStoreWorker.getStoreCurrencyUomId(request)

      This method in turn calls UtilHttp.getCurrencyUom(), which makes a number of attempts to find proper currency, with first attempt being session attribute "currencyUom".

      This is a chicken-egg problem though: first-time user does not have currencyUom attribute set, and WebShoppingCart is created immediatelly.

      But once created, nothing ever calls ShoppingCart.setCurrency()!
      The bug is in ShoppingCartEvents.getCartObject():

      if (cart == null)

      { cart = new WebShoppingCart(request, locale, currencyUom); session.setAttribute("shoppingCart", cart); }

      else {
      if (locale != null && !locale.equals(cart.getLocale()))

      { cart.setLocale(locale); }

      if (currencyUom != null && !currencyUom.equals(cart.getCurrency())) {

      Well, currencyUom parameter is always null.
      If null, it needs to be taken from request parameter, or even better, to go thru entire UtilHttp.getCurrency() thing.

      Attachments

        1. shoppingcart-currency.patch
          0.6 kB
          Josip Almasi

        Issue Links

          Activity

            People

              jleroux Jacques Le Roux
              jalmasi Josip Almasi
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: