Shopping carts ... developed sometime after the invention of the wheel and then not really updated until the advent of the internet and electronic shopping.
Two things I wonder about:
1) Is it better to use a session cookie or database for shopping cart storage?
2) Isn't it annoying when you have to click from one to another just to view you shopping cart entries?
Okay, so I don't really wonder about either of those above questions anymore. In short my answers are: 1) database, and 2) absolutely.
After the break is some thinking on the shopping cart storage. I'll come back in the near future to discuss an alternative to #2.
The processes I use are quite simple.
I generally use the session cookie simply to identify a signed in user, and if somebody isn't a registered and signed in user I use the session cookie to identify that person (notice the similarity?). I generally have some information stored in a database that is associated with a registered user of a web site and the value of the session cookie will contain something that I can use to bridge my way to the appropriate database entry. The exact bridging method is up to you.
You could, for example, assign a random value to a session cookie that is repeated somewhere in your database. The database value can then be used as a lookup for the user's information. You could simply use a database table index as the session cookie and thus have a more direct link from cookie to user information.
As I said, it's up to you. Keep in mind that if security is of top import a direct cookie to information link is not going to be good enough. In some cases you might not even want to hide this process from the user!
And thus on to the shopping cart ....
I like my shopping carts in the database, and then I associate the shopping cart entries in one form or another with the user or, in the case of a non-signed in user, the customer's session cookie value (the session cookie id is almost always going to be good enough to assure a unique identifier so I often substitute this for the value). Lose the session cookie? At least the registered site user can get back to her/his cart because it's in the database. The non-registered user who is identified by the session value (or id) is out of luck because the linking to the shopping cart has been lost.