[thelist] ASP: Shopping Cart Theory

Chris Blessing webguy at mail.rit.edu
Mon Jul 8 12:49:04 CDT 2002


Ken-

I just got done with a shopping cart system for my company and I went with
the session variable, storing each item in a "cart" array which holds:

item name
item product code
quantity

I was then able to create a "coupon book" array which I could relate to that
"cart" array, and therefore apply coupons to one/more products at a time.
All other product info like price, photo, etc. is stored and retrieved from
a database.  I chose to store the name in the array since it is accessed so
many times, thereby pseudo-caching it on the server-side rather than hitting
the db everytime I want to know what product I'm looking at.

I chose the array because while it may take up a bit more memory on the
server, the processing time for manipulating it (applying coupons,
removing/adding items, changing quantities, etc.) is much much quicker than
trying to manipulate some string stored in a cookie or something.  The
development time was significantly faster as well.

HTH!

Chris Blessing
webguy at mail.rit.edu
http://www.330i.net

> What's the general theory as to the best way to store items added to a
> shopping cart? Cookies? Session variables? Something else?
>
> Thanks, 'volters!
>
> -Ken




More information about the thelist mailing list