Forum Moderators: buckworks

Message Too Old, No Replies

Shopping Cart Question

How long to keep a users cart in the DB

         

wfernley

5:47 pm on Jun 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi everyone.

I am building a shopping cart for my company and I'm wondering how to delete entries in the users_cart table. I was curious how long I should leave a users cart session in the database. Also is it possible that when the user leaves the site or closes the browser window that the cart can be deleted? That could pose problems so what if I deleted it after a week or so. How could I setup an automated script that deletes old cart sessions?

Thanks for your help :)

Wes

flood6

6:29 pm on Jun 29, 2004 (gmt 0)

10+ Year Member



What scripting language and database are you using?

I would say that 2 weeks would be a safer period of time to save a shopping cart for a registered user (longer if you have the space, just in case...).

wfernley

6:36 pm on Jun 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The site is designed in PHP and MySQL. 2Weeks I think would be a good time period. How would I make it automatically delete old records? :)

BigHit

7:04 pm on Jun 29, 2004 (gmt 0)

10+ Year Member



Sorry to butt in, but also, how would this be done in with ASP.NET/SQL Server? Thanks :)

mattglet

7:19 pm on Jun 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The easiest way to do it with SQL Server is probably using Jobs (if you have access to the server).

Google "sql jobs" without quotes.

-Matt

wfernley

7:22 pm on Jun 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



SQL Jobs....I will look into those :)

I actually have a program called Navicat 2004 that has a Stored Procedures section. Can I set something up there to run a query every two weeks saying "Is this row old?" If yes - delete, if no - leave it alone.

I guess I could look into that too :)

Thanks

Wes

Morgenhund

8:07 am on Jun 30, 2004 (gmt 0)

10+ Year Member



I'd say I'd prefer to store products for a very long time -- for example, year or even more (of course, if you have enough space).

If there is a slightest possibility that returning customer comes back and finds something that he/she wanted to buy some time ago, but did not by some reason -- perhaps he/she will decide to buy it now?

Easy_Coder

3:40 am on Jul 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I run a nightly job that does the cleanup on guest baskets but allows the customer baskets to remain.

bmcgee

1:14 pm on Jul 6, 2004 (gmt 0)

10+ Year Member



I would say up to one month is a reasonable amount of time to save the user's cart, for them.

However, I would recommend saving all cart data and never purging it on your end. This allows you to view trends such as whether a product is going out of style, whether your conversion rate for a product is rising/dropping, etc.

However, once the cart gets a few weeks old, you won't want to show it to the user anymore. They'll likely forget they started a cart and be confused, or your pricing may change. Regardless, a cart is stale after a couple weeks.