Shopping Cart Schema - Sessions
| From: | Jason Beebe | Date: | Wed, 10 Jan 2001 08:14:51 +0000 |
| Subject: | Shopping Cart Schema - Sessions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-33629@lists.php.net to get a copy of this message | ||
Hey,
I'm looking for little information from those who have coded their own shopping cart apps. what
would you say the best way to setup a cart would be? more specificly, the method for adding items to
the cart.
say the user is broswing around. when they entered the website a new session was created. when they
go to add an item, what is the best way store variables (such as what they bought and quantity) in
the session. i have read that it is possible to put all of your session variables in a single
associative array. however, i have not had any luck doing this myself. Under such a method of an
array, how would i store each item (product id and quantity, possibly price as well) in the cart
into the session. obviously i don't expect anyone to write an entire app. i am comfortable
starting the session, and doing th db extraction and presentation. i just need to know how to store
a variable in a session (passed through post) and how to extract it when need be (considering it is
an array). Thanks a lot!