Developer forum

Forum » Ecommerce - Standard features » How to recreate cart context after application pool reycle

How to recreate cart context after application pool reycle

Ivan Marijanović
Ivan Marijanović
Reply

Hi!

We are facing following issue with one of our implementation. 

We created another cart context named WeeklyCart so user can add products to "normal" cart and checkout and he can add products to weekly cart which is automatically converted to order once per week. This work fine! We have two cart feeds, one for WeeklCart and one for cart withouth context and they return correct data!

When applicaiton pool is recycled then all of existing carts loose the context data and cart data feeds with WeeklyCart context and without cart context return the same data. 

We added code in notification subscriber Dynamicweb.Notifications.Standard.Application.AfterDynamicwebStart and we are able to set the cart ContextId correctly but the feeds are still showing the same data. What are we missing here?

Thank you in advance!

Ivan 


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Ivan

Can you shed some light over what the feeds are - are they pages in the page tree that return json or something else. And how are this setup or coded?

When the pool re-cycles, the user is logged out until next request (if login is stored in their login cookie) - when the user logs back in, it fires the Dynamicweb.Notifications.Standard.User.OnExtranetLogin notification which is picked up by ecommerce which will call Common.Context.LoadUserContextCarts() to load the context carts of that user.

In Ecommerce settngs under Advanced, there is a "Do not replace existing cart when user logs in" setting (/Globalsettings/Ecom/Cart/UsePreviousCartInsteadOfNewCart) which will affect how carts are reloaded - your description could indicate that you have this checkbox enabled, and you might want to try to disable it.

Also ensure to disable "Merge anonymous cart on login" checkbox (/Globalsettings/Ecom/Cart/MergeAnonymousCartOnLoggingIn)

 
Ivan Marijanović
Ivan Marijanović
Reply

Thanx Morten

It looks like we solved issue by marking two options in Settings - Advance Configuration - Shopping cart:

1. Recalculate a user's cart when the user logs in
2. Cart Context - Allow different context dates

We are still testing but it looks like it is solution!

Ivan

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Great - good find!

 

You must be logged in to post in the forum