Jump to content

Store Shopping Cart Information - Session vs. Cookies


Recommended Posts

What's the best way to store shopping cart information? I want things to stay in the cart for up to 2 weeks after they're added, without the need for somebody to log-in to their account to store them. Should I store the information in a database some how and then set a cookie referencing the cart_id in the db?

As fugix says,

 

 

Store the values in a database, after inserting, set a COOKIE with the ID of the entry or create your own Id's. Using sessions is not recommended as they are destroyed on session closure (browser closure).. Cookies can also be removed so it may not be possible to store it for 2 weeks for everyone.

 

 

It is dependant on the users preferences, but the method explained will work.

 

 

George.

As fugix says,

 

 

Store the values in a database, after inserting, set a COOKIE with the ID of the entry or create your own Id's. Using sessions is not recommended as they are destroyed on session closure (browser closure).. Cookies can also be removed so it may not be possible to store it for 2 weeks for everyone.

 

 

It is dependant on the users preferences, but the method explained will work.

 

 

George.

right, and upon the destruction of the cookie after 2 weeks...simply set a delete clause to delete the row where the information is stored

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.