Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How do I keep cart contents for only 1 hour?


Guest

Recommended Posts

Posted

after adding an item to the cart and logging off (without checking out) the cart items remain. I want them only to appear for the next hour. I can login for days afterwards and my cart contents are still there. Is this in sessions.php? Or is there a timer at all on cart contents. My sessions are being stored in the database.

 

any help!!! thanks

Posted

The cart contents are supposed to be maintained when a user logs out. They are stored in the database in the 'customers_basket' table.

 

I believe you would need to change the customers_basket_date_added in that table to include the time as well as change the code to add the time in the PHP files. You would then need to insert code somewhere (perhaps in application top would be easiest) to clear the cart contents if the current date/time was 1 hour or more than the date/time the product was added.

 

I don't think there's a simple answer to this one. It would actually be easier if you simply had the cart contents killed on logout.

Posted

Just curious, why would you want to do that? I know that many online shoppers (myself included) will go to a site, add things to their cart to get the price, then come back later to purchase...sometimes I'm price-matching elsewhere, sometimes I just want to know what it will cost...but it's nice to come back later and still have that info.

Chris Dunning

osCommerce, Contributions Moderator Team

 

Please do not send me PM! I do not read or answer these often. Use the email button instead!

 

I do NOT support contributions other than my own. Emails asking for support on other people's contributions will be ignored. Ask in the forum or contact the contribution author directly.

Posted

I'm actually converting OScommerce from an online store to a POS system. I only want someone to be able to add items to the cart and have one hour to pick them up at the store. Then automatically thier cart is wiped out if they don't show up. I guess you can say its a "on hold" cart system.

Posted

In that case, Draven has the right idea. Put a timestamp on the cart contents, then run a check on a regular basis to wipe out carts more than an hour old.

Chris Dunning

osCommerce, Contributions Moderator Team

 

Please do not send me PM! I do not read or answer these often. Use the email button instead!

 

I do NOT support contributions other than my own. Emails asking for support on other people's contributions will be ignored. Ask in the forum or contact the contribution author directly.

Posted

Thanks for all your help. I inserted a new field in the customer_basket table as a Current_timestamp() data field. When the cart gets an item the item also gets a timestamp. I then run a SQL query against the table to find any items over 1 hour old and then simply delete these cart items. Works great!!!!!

 

thanks again

Archived

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

×
×
  • Create New...