• Welcome to KonaKart Community Forum. Please login or sign up.
 

forceRegisterCustomer

Started by sdyck, May 07, 2009, 03:35:40 pm

Previous topic - Next topic

sdyck

I have this unique use case where I do not require the user to login or register but their cart is saved for 30 days.  In our old implementation we stored a unique shopping cart sessionId in their cookie which stayed around for 30 days.

If I call forceRegisterCustomer the first time the user comes to the store, and say they leave before check-out...
How can I get back to their old cart?
Do I save the customerId returned from forceRegisterCustomer in their cookie and use getBasketItemsPerCustomer() passing in this customerId ?
Does the second call to forceRegisterCustomer, even with the same email, init a clean and empty basket?

I'm asking this because I know that the Basket of items are saved if the user IS registered.

trevor

Every time a customer comes to the store, we create a temporary customer with a negative id so that we can store his basket items in the database. In our next version, we've added functionality whereby we save this temporary id in a cookie so that he can look at the items he added on the previous visit and so that we don't create a new temporary user if the user is recognized through the cookie.

sdyck

This sounds like exactly what I want.  Is this change going to be in the storefront application?  If yes, how can I ensure I get this change without having to re-work what I have customized?  If not, then I'm assuming there will just be new API calls I could invoke.  Do you have an ETA on the new release?

sdyck

What if I did the same thing that you guys are planning?  I'd have to do the following I think:

if(cookie == null){
  if(customer != null){
    delete customer // don't want to see Basket items > 30 days old
  }
  int id = forceRegisterCustomer()
  saveIdToCookie(id)
}

your thoughts?

trevor

The way we do it is to create a UUID for the temporary customer that is created when someone comes to the store front. We save this UUID in the browser cookie and also save it in our database together with the customer id (which will be negative). When the customer comes along again, we get the UUID from the browser cookie and use that to look up the id. If the negative id already exists then we don't create a new temporary customer and we refresh the basket.

At the moment we haven't fixed a date for the next release.