[jira] [Created] (OFBIZ-9336) Ecommerce login/logout events don't work properly for Shopping Cart

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (OFBIZ-9336) Ecommerce login/logout events don't work properly for Shopping Cart

Nicolas Malin (Jira)
Alexander Tzvetanov created OFBIZ-9336:
------------------------------------------

             Summary: Ecommerce login/logout events don't work properly for Shopping Cart
                 Key: OFBIZ-9336
                 URL: https://issues.apache.org/jira/browse/OFBIZ-9336
             Project: OFBiz
          Issue Type: Bug
          Components: ecommerce
    Affects Versions: Release Branch 16.11, Release Branch 15.12
         Environment: Linux, PostgreSQL
            Reporter: Alexander Tzvetanov


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.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)