How to manage customer basket
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
- PaoloLegaspi
- Posts: 24
- Joined: 07 Nov 2024, 15:02
How to manage customer basket
Hi,
I’m working with Aimeos Headless and JWT, and I’ve run into an issue with user basket items. Since the customer basket is tied to the session, I was wondering if it’s possible to handle these scenarios:
1. Merge or restore a guest basket with the user’s existing basket when they log in.
2. Persist customer’s basket even after they log out or when the session ends.
Any guidance on this would be much appreciated!
Thanks!
I’m working with Aimeos Headless and JWT, and I’ve run into an issue with user basket items. Since the customer basket is tied to the session, I was wondering if it’s possible to handle these scenarios:
1. Merge or restore a guest basket with the user’s existing basket when they log in.
2. Persist customer’s basket even after they log out or when the session ends.
Any guidance on this would be much appreciated!
Thanks!
Re: How to manage customer basket
It's possible when you extend the Laravel/JWT login controller to load the last basket of the customer. The basket is already stored in the database with the ID of the customer if he is logged in.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
- PaoloLegaspi
- Posts: 24
- Joined: 07 Nov 2024, 15:02
Re: How to manage customer basket
Hi,
I noticed an issue where, if a client adds products to their basket before logging in, those items don’t carry over after they log in. The basket also doesn’t get linked to the customer’s account. How can I make sure the basket items persist after the user logs in?
I noticed an issue where, if a client adds products to their basket before logging in, those items don’t carry over after they log in. The basket also doesn’t get linked to the customer’s account. How can I make sure the basket items persist after the user logs in?
Code: Select all
Aimeos version: Aimeos Headless 2024.07.*
PHP version: 8.2
Environment: Mac
Re: How to manage customer basket
The basket is session based, so make sure you send the correct (same) session cookie value to the server after login. The basket is stored in the database using a "token", which is stored in that session:
https://github.com/aimeos/aimeos-larave ... #L260-L267
https://github.com/aimeos/aimeos-larave ... #L260-L267
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: How to manage customer basket
Regarding the customer ID which isn't added to the basket after login, please update aimeos/ai-controller-frontend to 2024.10.x-dev. This change should improve the situation to assign the customer ID to the basket when customers log in after the basket has been created:
https://github.com/aimeos/ai-controller ... 97eb636048
https://github.com/aimeos/ai-controller ... 97eb636048
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
- PaoloLegaspi
- Posts: 24
- Joined: 07 Nov 2024, 15:02
Re: How to manage customer basket
Hello, I just updated to the new version, and it’s now working on our end. Thank you!