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

Ecommerce login/logout events don't work properly for Shopping Cart

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • Release Branch 15.12, Release Branch 16.11
    • 17.12.01
    • ecommerce
    • None
    • Linux, PostgreSQL

    • Important

    Description

      How to reproduce:
      1. Sign in;
      2. Add more than two items in the shopping cart;
      3. Sign out (or close the browser);
      4. Sign in back again.
      You will see that only one item is restored back in the shopping cart (instead of many). The other items are not restored back there.
      5. In the system console appears an error that show that you do not have permissions to modify somebody else's shopping cart.
      This error prevents the items that are in the user's list to be completely restored. Only first item stays restored in the cart.

      What caused this:
      Since I tracked the sign-in process I found the following events order:
      The events that occurred during the login process are:
      1. Pre-processor calls "keepCartUpdated". However at this time the session context is not still in "signed in" stage, and the shopping cart object is restored as from an anonymous user;
      2. Log-in has been called afterwards, and session becomes "signed in" with the user;
      3. At the end the "logIn" function calls "after-login" section, described in "context.xml" file;
      4. In "after-login" section, there is again "keepCartUpdated" listed. It is there in order to update the shopping cart with the new context including the logged in user.
      However, because "preprocessor" already called "keepCartUpdated", Ofbiz skipped to call this event handler again. And as a result the shopping card stays "anonymous".

      How I fixed this issue on my side:
      I just renamed "keepCartUpdated" event to "keepCartUpdated1" in the "after-login" section in "context.xml" and shopping cart worked correctly.

      Attachments

        Issue Links

          Activity

            People

              jleroux Jacques Le Roux
              sashoran Alexander Tzvetanov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: