Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with the cart, when i get items into the cart with logged in user.... #8

Open
igorsavinkin opened this issue Jan 27, 2014 · 1 comment

Comments

@igorsavinkin
Copy link

Problem with the cart. When i get items into the cart with logged in user the cart is ok. When i log out the cart gets empty. If i log in with the same user, whose cart has not been empty, the cart DOES not restore its content. How to deal with it?
Many webstores want/allow users to get items PRIOR the logging in, So if user got items in cart, then it gets registered and logs in all his cart items age gone, kind of disappointment...

@LordotU
Copy link

LordotU commented Sep 5, 2014

If you still interested for problem solving...

For the first, you need to add false parameter value to your logout method (http://www.yiiframework.com/doc/api/1.1/CWebUser#logout-detail):

Yii::app()->user->logout(false);

Next, you need to change 2 lines in EShoppingCart.php:

Line 121 to Yii::app()->session[$this->cartId] = serialize($this->toArray());

Line 36 to $data = unserialize(Yii::app()->session[$this->cartId]);

After applying of these changes, user's cart data will persist even after logging out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants