Click here to Skip to main content
15,790,243 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I am creating an e-commerce website for my project. I completed most of it, but confused about one topic. How can I keep current shopping-cart data of user?

I think that if I created a table in database and shopping cart items are kept in that table until order finishes. Then, I can delete that item from the shopping cart table. In this case, if the user quits without giving order and enters the site later, his shopping cart will not be lost and he will continue his shopping.

Is this a good programming way(I mean efficent) or should I use something like memcache?


1 solution

The normal ways are to either keep it in a database - in which case you will have to do regular checks to "sweep out" old, redundant data, or in cookies - in which case they sit on the user PC and can be set to expire naturally after a period of time - a week, or a month say.

Personally, I use cookies - it keeps the data with the user PC.
Share this answer
Çağlar Tolga Tetik 21-May-12 19:44pm    
Ok. Thanks a lot. I think keeping in database will be easier for me.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900