SilverCart Forum

We moderate this Forum and we're here to help. Have you already run a forum search to check if your problem has already been solved?

You can help us helping you by providing detailed error messages, screenshots and logfile entries.

SebastianRamon

Page: 1
Topic bug: anonymous user's cart gets emptied 2566 Views

bug: anonymous user's cart gets emptied

27 October 2013 at 11:45pm

Hi,

If an anonymous user with a _not_ empty cart uses the lost password function _from_ the _checkout_ page, after the password reset email has been sent the content of the cart gets emptied!

Interestingly, using the same lost password function (/Security/lostpassword) from the login widget box does not have the same effect, the cart's content stays intact in this case.

regards,
Szabesz

Re: bug: anonymous user's cart gets emptied

28 October 2013 at 7:07pm

Thanks for reporting. We'll look into this.

Cheers
Ramon

Re: bug: anonymous user's cart gets emptied

16 November 2013 at 12:18pm

Hi Szabesz,

this is a known issue and caused by Sapphire itself.

This will happen every time a anonymous customer with a filled cart will call the password recover URL out of the email sent after entering the email address and pressing the button.

Technically, an anonymous customer is a real Member object, existing in database. The anonymous Member data object will be created at the time, a visitor adds a product into cart (without Member a cart can not exist).

The problem:
SilverStripes "lost password" function uses the same "change password" function that will be used for a logged in Member.
A logged in Member will see 3 input fields instead of 2:
1. Current Members password
2. New password
3. Repeating new password

Anonymous customers do not have passwords, they can't login.
But they are Members and SilverStripe expects them to have a password and they have to validate the current (not existent) password before entering a new one.
So, we extended the security controller to log anonymous customers out before changing passwords.
This results in loosing the current cart because it is related to the anonymous Member object.

It would be possible to restore the anonymous cart out of session after changing the password, but this issue has a low priority for us.

We will fix this, but I can't say when.

Re: bug: anonymous user's cart gets emptied

16 November 2013 at 12:34pm

Hi Sebastian,

Thank you for explaining it! It the meantime, isn't it possible to inform the customer and at the same ask what they want to do? I'm thinking of an alert box (or a lightbox like modal, to be more design friendly) like this:

Notice!
Using the lost password function will empty your shopping cart. Would you like to proceed?
Yes/No

Or something similar :)

cheers
Szabesz