Jump to content

[SOLVED] Storing Data For Shopping Carts - Advice Needed


Canman2005

Recommended Posts

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

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.