Hi All,
I’m basically new to shopping cart applications so I really appreciate all your suggestions on this regard.
When a user entered to my website (Shopping cart) I create an individual session ID for users. Using that session ID I keep track of individual user and the products he added to his shopping cart. I got 2 tables for that. The basic table layout is,
shoppingcart
ID
sessionId
shoppingCartDetails
cartId
productId
qty
So now I know which user added which product and how many.
Remember still user haven’t logged in. In a sense users don’t need to log into the system in order to add the products into the cart. He can do it without login in. When ever user going to checkout he always needs to login.
My question is, let’s assume a person came to the site and added 2 items and he just close the browser without checking out or login. So the records will remain in the table and if 1000 people done it then there will be whole lots of junk data will be stored in those tables.
What I wanted is when ever user did something like this, I want to delete all the unused session details from that both tables.
My idea of a solution
I was thinking to have another table called "siteUsers".
siteUsers
sessionId
time
Then call an AJAX function in every 5 min to update the time. So while I’m updating the time I will check the existing data’s time and delete all the sessions which 10 min. less than current time.
What do you guys think about this?
Is there’s any standard ways of doing shopping carts? What are your suggestions on this regard?
Thanx in advance,
Regards,
Niroshan