Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Temporary Tables in Shopping Cart projects 1

Status
Not open for further replies.

Ann07

Programmer
Oct 5, 2007
1
Hello,
I am developing a shopping cart project and stuck at the part of adding products to the shopping cart. Is it a best practice to use temporary tables for holding the items in the shopping cart.My view point is if the user leave the session before checking out or they wanted to view their cart summary before check out, can we store that data in a temporary table.I know that using temp table is not a good idea from the performance view point. Is there any better options available other than using a temp table. Your opinion is much appreciated
Thanks
Ann
 
a db temp table isn't good at all because it's only around for the current connection. the table could be dropped between post backs.

some other options:
1. store the data in session.
2. store the data in a text file
3. store the data in a shopping cart table in db.

each has their pros and cons. depending on the requirements of the project would determine the best option.

1. pros :
maintains itself (destoryed after session logout)
asseccible only by current user.
persists through postbacks/web pages.

cons:
100s of users may create a resource hit.
cannot persist between sessions.

2. pros :
persists through mulitple sessions.
cons :
file maintainence for abondoned orders. (delete on session log out?)
IO hit everytime you need to modify cart
3. pros :
persists across sessions
perminant table to store orders before actually ordering. (writing to order table)
easy to include into DAL schema
security model can follow the rest of domain model
cons :
record maintainence for abondoned orders. (delete on session log out?)
db hit everytime you need to modify cart

i would opt for 1 or 3 depending on the requirements, hardware, and scope of the project

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
You can also create a cookie on the user's pc.. if they allow cookies. You can also set the expiration date for the cookie as well
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top