Keep basket even when user logs out and logs back in?

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
kdim95
Advanced
Posts: 205
Joined: 26 Aug 2022, 12:17

Keep basket even when user logs out and logs back in?

Post by kdim95 » 19 Sep 2023, 08:15

Laravel framework version: 10.16.1
Aimeos Laravel version: 2023.04.*
PHP Version: 8.2.8
Environment: Linux

Hello,

Is it possible to store the basket even after the user logged out and logged back in?
How can I do it?

Thanks

kdim95
Advanced
Posts: 205
Joined: 26 Aug 2022, 12:17

Re: Keep basket even when user logs out and logs back in?

Post by kdim95 » 19 Sep 2023, 08:22

Clarification:

1) The basket should be lost, but stored in the user's account when he user logs out.
2) The basket should be loaded when the user logs back in.

User avatar
aimeos
Administrator
Posts: 7894
Joined: 01 Jan 1970, 00:00

Re: Keep basket even when user logs out and logs back in?

Post by aimeos » 19 Sep 2023, 22:09

Currently it's not possible but the basket of the customer is stored in the mshop_order_basket table. There's currently just no way to get it back after re-login and you need to implement that yourself.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

kdim95
Advanced
Posts: 205
Joined: 26 Aug 2022, 12:17

Re: Keep basket even when user logs out and logs back in?

Post by kdim95 » 20 Sep 2023, 12:03

What is the relation between the mshop_order_basket table and the basket stored in the session?
Can the session with the basket just be restored when the user logs back in?
I really don't know how I should go about this.
Can you give a more detailed response?
Thanks.

User avatar
aimeos
Administrator
Posts: 7894
Joined: 01 Jan 1970, 00:00

Re: Keep basket even when user logs out and logs back in?

Post by aimeos » 22 Sep 2023, 07:39

The session basket is stored as serialized value in the mshop_order_basket table and you can use its manager to retrieve them again. If customers are logged in, their customer ID is stored along with the serialized basket too. To load the last basket after login, you have to use the manager to get the latest basket for the current customer ID in the Laravel controller handling logins.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply