HDFilmMaker2112 Posted May 31, 2011 Share Posted May 31, 2011 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? Quote Link to comment Share on other sites More sharing options...
fugix Posted May 31, 2011 Share Posted May 31, 2011 you could store the information inside of a database...and have a field with the date that you want the information to expire..then write a script to delete that row when the current date is equal to the date that you have stored Quote Link to comment Share on other sites More sharing options...
George Botley Posted May 31, 2011 Share Posted May 31, 2011 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. Quote Link to comment Share on other sites More sharing options...
fugix Posted May 31, 2011 Share Posted May 31, 2011 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 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.