1

Unfortunately, due to circumstances beyond my control, I need to make the following configuration work:

Alice logs in as a Customer with username foo.

Then Bob logs in as the same Customer (foo) on a different browser.

Alice and Bob each have separate shopping carts. When Alice adds something to the cart in her browser, Bob's cart is not affected.

In Magento's default configuration, Alice and Bob share one cart stored on the server, and thus the cart is synchronized between them. Is there any way I can force Magento's sessions to work the way I need them to?

5
  • 2
    Poor design decision.
    – Ashfame
    Commented May 3, 2013 at 19:54
  • Believe me, I know.
    – user2060
    Commented May 3, 2013 at 20:14
  • I don't see the problem. The last paragraph is wrong. If you have two sessions, you have two sessions IDs and if you login in two differen account, the cart is NOT shared, why should it? Someone has to explain me, how you interpret the qestions. There are two answers and I see no problem :D Commented May 5, 2013 at 6:01
  • @FabianBlechschnmidt If you log in, whatever is currently in your cart gets added to the existing quote still open on your account Commented May 5, 2013 at 12:02
  • Yes, but this is not the behavious user2060 describes, is it? Commented May 5, 2013 at 21:30

2 Answers 2

1

Technically speaking, each user has a different session. The "problem" for you is that a quote object is tied directly to the customer, not the browser session. This is necessary to have saved carts. And as @ashfame pointed out, this is a poor design decision.

Beyond this being a poor design decision though, what you want is not going to be easy (nor simple). Doing this would require massive amounts of custom code, would necessitate redesigning database schemas and refactoring tons of quote related code and logic. At the end of the day, it's going to be buggy and won't work with the customer cart functionality in the admin, since the admin was only designed to have one cart per customer.

To me, and without any context of the client needs, it sounds like you are dealing with B2B user scenarios which should be solved in other ways.

My suggestion is, go back to the drawing board. Don't try to simply bend Magento to do something like this…it will bit you in the end unless you have hundreds of man hours to throw at it and are willing to create a site which will be 100% non-upgradable without rebuilding all the custom development work. Most clients will thank you if you are willing to explain why what they want is a poor decision and instead recommend an alternative approach.

1

On reflection, it looks like a situation we have ourself.

We built a ticketing system on Magento - whereby there was a "parent" account - with users created within that. So it meant that a single company could have 1 account, with all the invoices and tickets under one master/main account (for auditing); but within that, all the users had their own accounts - they were merely "associated" with this master account.

It only meant adding a couple of variables to the customer to define whether it was a parent/user account, and adding a respective link to the parent account.

Ultimately, it meant that individual users could have their own carts/sessions/profiles - but when a purchase was made, the invoice was tied to the "parent" account - rather than the user account. So it was visible to every user within that parent account.

We'd even extended the functionality to include a 1-many relationship between a user and many parent accounts (so that a user could belong to multiple companies). Beyond that, we even added ACLs to restrict what could and couldn't be viewed.

It turned out to only be around 3 days work - so its possible and fairly easily at that. It just depends on the level of functionality you really need.


Its not really native to Magento - but don't let that put you off. Magento isn't always about native functionality, its about being a platform to grow on; to modify and adjust to suit your needs.

1
  • I will completely echo that last paragraph! We've done similar developments for some B2B sites, but with a more complex set of rules.
    – davidalger
    Commented May 4, 2013 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.