Canman2005 Posted July 13, 2008 Share Posted July 13, 2008 Hi everyone I'm building a shopping cart for a friend and so far I am at a point where a customer ID number is generated when they first access the shop. To create this number I have done some random number generator and database timestamp to create this. My question is, what do you think is the best way to store the products they are adding to their cart as they use it? Is it best to save the product they add to their cart in a database table along with the customer ID number, or is it best to do this all as sessions and don't insert any of the products they add until they have completed the payment page? Personally I would store it in a database, but the database maybe quite big sometime in the future with old order information that was never purchased and therefore slow the system down. What do you think? Thanks Ed Quote Link to comment Share on other sites More sharing options...
teynon Posted July 13, 2008 Share Posted July 13, 2008 I dont see the point of using a database if they haven't registered, etc. Someone just visiting the site without a membership should only be using sessions to carry order information. I'm assuming your trying to make it so if they leave and come back, their stuff will still be there. Storing it in a database will require them to have the session data still intact anyways. So you might as well use sessions or cookies. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted July 13, 2008 Share Posted July 13, 2008 Store pending order information in your database (do you want to make them reenter it if someone trips over their power cord and their computer turns off or they leave their computer for a short time and someone closes the browser?) You would typically use a cron job or a scheduled task to remove pending orders that were never completed that are over a certain age. Quote Link to comment Share on other sites More sharing options...
Canman2005 Posted July 13, 2008 Author Share Posted July 13, 2008 thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.