Developer forum

Forum » Development » Shared login and carts

Shared login and carts

Mikkel Høst
Reply

Hi.

I have a request from a customer about having a user in DW that many people can use to shop. The problem here is that the cart is saved on the user and therefore two users can't be logged in at the same time without updating the same cart. 

The ideal solution that comes to mind: Force DW not to save/load the cart for the user from the DB and always load/set the cart present in the cookie or create a new one.

Load/set cart from a cookie is easy to do with the API. But making sure DW don't load the cart from DB I don't know how to do. Is this possible to configure and if so can it be done on certain users/groups only?

Maybe someone could shed some light on alternative solutions or pitfalls in this approach?


Replies

 
Nicolai Pedersen
Reply

Hi Mikkel

If your solution is brand new (8.9.1) you have a new fancy checkbox that does just that.

BR Nicolai

Dynamicweb, The Checkbox CMSTM

Capture.PNG
 
Mikkel Høst
Reply

Hi Nicolai.

Checkbox CMS FTW; That's cool but unfortunately we are on an 8.4.0.10. 

two questions

1. If we were to upgrade - could this feature be enabled for specific users/groups only?

2. If we can't upgrade - any ideas on how to bypass the "load cart from DB" or maybe even hook in after the cart has been loaded from DB and before the cookie is overwritten by the cart loaded from DB ?

 

 
Nicolai Pedersen
Reply

@1: No - all or nothing...

@2: That is an old DW... Things have changed a lot related to loading of cart, so my answer may not be good...

Dynamicweb.eCommerce.Common.Context.Cart should be set very very very early in the request (Begin_request or something like that) to what you want. If you do that, DW should leave it alone. You do that by calling SetCart on the Dynamicweb.eCommerce.Common.Context.

You can find the 8.4 branch in TFS if you want to hook into the source and what actually happens during load in that version.

BR Nicolai

 

You must be logged in to post in the forum