Help for integrating the Laravel package
Forum rules: Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#2764 by afoster009
10 May 2016, 22:59
Hello there, I am trying to set up aimeos so that each user is assigned their own cart.

Id like it so if i logged in with user A it would show their items they had in there cart, and if i log in with user B it will show the items they have in their cart.

As of now...When i log in with any user associated with my application the cart is the same for each user, containing the same items across all users.

Right now you must sign up to reach the /list page so you must be logged in to use the shop.

Im not sure how to configure aimeos to store unique cart info between users.
#2766 by aimeos
11 May 2016, 06:40
The cart is bound to the session of the user. Each user has an own session, regardless which login he is using. If you want to enable the same user to have different sessions for each login, you have to overwrite the getSession()/setSession() method of the order base manager and add the user ID from the context:
- https://github.com/aimeos/aimeos-core/blob/master/lib/mshoplib/src/MShop/Order/Manager/Base/Standard.php#L907
- https://github.com/aimeos/aimeos-core/blob/master/lib/mshoplib/src/MShop/Order/Manager/Base/Standard.php#L931
#2770 by aimeos
12 May 2016, 00:56
You can use something like this in the getSession*()/setSession*() methods:
Code: Select all$key = 'aimeos/basket/content-' . $sitecode . '-' . $language . '-' . $currency . '-' . strval( $type ) . '-' . $context->getUserId();


Extend the class, overwrite the named methods and configure the new class name for usage.
Also, be aware that this only works flawlessly for the requested context. If customer don't have to login first, the basket will be empty after they do so.
#3075 by jossnaz
25 Jul 2016, 10:31
what aimeos is saying is that each user HAS his own cart. The thing you are doing is wrong, is for faking the customers, you use the same browser and no incognito mode. It is unlikely that users will use the same computer, with the same browser, to work with aimeos on different accounts, without logging out in between.

So for your testing case i guess it can work if you use a new incognito window for login

afoster009 wrote:Hello there, I am trying to set up aimeos so that each user is assigned their own cart.

Id like it so if i logged in with user A it would show their items they had in there cart, and if i log in with user B it will show the items they have in their cart.

As of now...When i log in with any user associated with my application the cart is the same for each user, containing the same items across all users.

Right now you must sign up to reach the /list page so you must be logged in to use the shop.

Im not sure how to configure aimeos to store unique cart info between users.