sridhar Posted March 17, 2007 Posted March 17, 2007 hi, this is sridhar I am working on one website. In this actually the client requirement is--------If any body adds the product to the cart , then the product will not appear to any body. The client fix some time to that.If client fixes ten minutes , then after ten minutes the product will be appeared. In these 10 minutes the customer should buy that product other wise the cart should be empty after 10 minutes.This is my problem, If any body knows about this give reply fast. Thankyou.
vasttech Posted March 17, 2007 Posted March 17, 2007 Wow, that's a tough one. :) Haven't heard of anyone doing it, but it could be done with a few changes to the way things work. Without going through the entire detail here is the way I would see it being done (and there could be a better way but it is early and I just woke up). I would add a time stamp field to the products table. When an item is added to someone's cart the time stamp is set and the quantity available is set to 0 (or the product is set inactive, so that it appears out of stock). Then you would have to modify all the product listing pages to check that time stamp to see if it is older then 10 minutes or whatever amount each time someone does a product listing (including new products, featured, categories, etc...). If it is older then 10 minutes update the database to set the quantity available back to one (or set the product active). The one problem I could see is that obviously if 2 people are looking at the same product at the same time and one clicks on add to cart just a split second ahead of the other the other one won't be able to add it to the cart. Hope that helps or at least gives you an idea for doing it somehow. osCommerce Knowledge Base osCommerce Documentation Contributions
sridhar Posted March 17, 2007 Author Posted March 17, 2007 Hi Thanks for your reply, Upto inactive the product and activation after 10 minutes ok. How can i empty the cart after 10 minutes whether he is register user or not. Thankyou
Guest Posted March 17, 2007 Posted March 17, 2007 in application_top.php you could register a session to do this: if( !tep_session_is_registered('cart_timeout') ) { tep_session_register('cart_timeout'); $cart_timeout = time(); } else { if( $cart_timeout < time()-600 ) { $cart->reset(true); $cart_timeout = time(); } } I used 10 minutes but you could change the time interval to a shorter period for testing
sridhar Posted March 22, 2007 Author Posted March 22, 2007 Hi, here Cart is empty is working after expiry time, but the problem is after emptying the cart again the user wish to add the product , the product is not added to the cart. That is my problem.
vasttech Posted March 22, 2007 Posted March 22, 2007 you need to unset the session variable for cart_timeout when you delete the product from the cart after 10 minutes. the problem now comes in you have multiple products that you want to do the same thing for, you will have to create a unique session timeout variable for each product. otherwise when you clear one you will clear them all. osCommerce Knowledge Base osCommerce Documentation Contributions
sridhar Posted March 22, 2007 Author Posted March 22, 2007 Hi, How to unset the cart, please explain clearly, I am not understanding.
sridhar Posted March 22, 2007 Author Posted March 22, 2007 Hi, After emptying the shopping cart, All products are displayed, After displaying the products we can add one more product to cart it take two products are invisible(including first one),but i want only one product to invisible.How can it solve. Thank you,
Guest Posted March 22, 2007 Posted March 22, 2007 Hi, here Cart is empty is working after expiry time, but the problem is after emptying the cart again the user wish to add the product , the product is not added to the cart. That is my problem. have you implemented that code and if so where in application_top.php?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.