925SILVER4U Posted December 16, 2006 Share Posted December 16, 2006 Contribution at : http://www.oscommerce.com/community/contributions,4738 Try adding some items to your cart on amazon.com (even without having an account with them) - close your browser, or return after 2-3 days - you will see that the items you added to your cart are still there. Try it on your oscommerce store - it doesnt happen - but this contribution will do that for you. Quote Link to comment Share on other sites More sharing options...
Tomcat Posted December 17, 2006 Share Posted December 17, 2006 Contribution at : http://www.oscommerce.com/community/contributions,4738Try adding some items to your cart on amazon.com (even without having an account with them) - close your browser, or return after 2-3 days - you will see that the items you added to your cart are still there. Try it on your oscommerce store - it doesnt happen - but this contribution will do that for you. Can you highlight and comment the changes for those like me who can't just replace the file ? Thanks Quote Outside links in signatures are not allowed! Link to comment Share on other sites More sharing options...
925SILVER4U Posted December 17, 2006 Author Share Posted December 17, 2006 Can you highlight and comment the changes for those like me who can't just replace the file ? Thanks Line 148 - Line 159 in /includes/application_top.php // *** INTACT SHOPPING CART MODIFICATIONS // set the session cookie parameters if (function_exists('session_set_cookie_params')) { session_set_cookie_params(604800, $cookie_path, ""/*$cookie_domain*/); } elseif (function_exists('ini_set')) { ini_set('session.cookie_lifetime', '604800'); ini_set('session.cookie_path', $cookie_path); ini_set('session.cookie_domain', ""/*$cookie_domain*/); } // *** END MODIFICATIONS *** In /includes/functions/sessions.php Add this : // **** SET SESSION LIFETIME HERE *** $SESS_LIFE = 604800; //7 DAYS *24 HOURS *60 MINUTES *60 SECONDS // *** SET SESSION LIFETIME HERE BEFORE: function _sess_open($save_path, $session_name) { return true; } Quote Link to comment Share on other sites More sharing options...
Guest Posted December 17, 2006 Share Posted December 17, 2006 Line 148 - Line 159 in /includes/application_top.php// *** INTACT SHOPPING CART MODIFICATIONS // set the session cookie parameters if (function_exists('session_set_cookie_params')) { session_set_cookie_params(604800, $cookie_path, ""/*$cookie_domain*/); } elseif (function_exists('ini_set')) { ini_set('session.cookie_lifetime', '604800'); ini_set('session.cookie_path', $cookie_path); ini_set('session.cookie_domain', ""/*$cookie_domain*/); } // *** END MODIFICATIONS *** In /includes/functions/sessions.php Add this : // **** SET SESSION LIFETIME HERE *** $SESS_LIFE = 604800; //7 DAYS *24 HOURS *60 MINUTES *60 SECONDS // *** SET SESSION LIFETIME HERE BEFORE: function _sess_open($save_path, $session_name) { return true; } Well, I made these changes, but when I add something to my cart and then leave the site (just go to another site or close the browser) and go back, there is nothing in the cart. I tested using IE 7 with a medium (default) setting on privacy and with Mozilla Firefox 2 set to accept cookies and keep them until they expire. Quote Link to comment Share on other sites More sharing options...
925SILVER4U Posted December 17, 2006 Author Share Posted December 17, 2006 Well, I made these changes, but when I add something to my cart and then leave the site (just go to another site or close the browser) and go back, there is nothing in the cart. I tested using IE 7 with a medium (default) setting on privacy and with Mozilla Firefox 2 set to accept cookies and keep them until they expire. Try it on my site 925silver4u.com it works. Perhaps its your Sessions settings in Configuration. Quote Link to comment Share on other sites More sharing options...
Guest Posted December 17, 2006 Share Posted December 17, 2006 Try it on my site 925silver4u.com it works. Perhaps its your Sessions settings in Configuration. What settings are you using? Quote Link to comment Share on other sites More sharing options...
celextel Posted December 18, 2006 Share Posted December 18, 2006 Try it on my site 925silver4u.com it works. Perhaps its your Sessions settings in Configuration. Hello, We are also interested in this very useful contribution. Please let us know the Sessions Settings that you are using so that we could configure the same accordingly. Thanks, Lakshmanan S. Quote Link to comment Share on other sites More sharing options...
925SILVER4U Posted December 18, 2006 Author Share Posted December 18, 2006 Hello, We are also interested in this very useful contribution. Please let us know the Sessions Settings that you are using so that we could configure the same accordingly. Thanks, Lakshmanan S. Here you are: Session Directory <CENSORED> Force Cookie Use True Info Check SSL Session ID True Info Check User Agent False Info Check IP Address False Info Prevent Spider Sessions True Info Recreate Session False Info Quote Link to comment Share on other sites More sharing options...
celextel Posted December 18, 2006 Share Posted December 18, 2006 Here you are: Session Directory <CENSORED> Force Cookie Use True Info Check SSL Session ID True Info Check User Agent False Info Check IP Address False Info Prevent Spider Sessions True Info Recreate Session False Info Thanks. Quote Link to comment Share on other sites More sharing options...
tsteele Posted December 21, 2006 Share Posted December 21, 2006 Nice contribution...one that I felt was always needed in OSCommerce! One thing I noticed is that with the contribution installed, the cart does remain for the customer, but that when the customer returns again to the website the shopping cart shows it is empty (on the first page loaded) until the customer visits their cart. Is there a way to pull the cart info on the first click back into the site? It is a bit missleading... If we can figure out how to retrieve the cart on the first page loaded from the site...it would be better! Keep up the good work!! Quote Link to comment Share on other sites More sharing options...
tsteele Posted December 21, 2006 Share Posted December 21, 2006 // **** SET SESSION LIFETIME HERE *** $SESS_LIFE = 604800; //7 DAYS *24 HOURS *60 MINUTES *60 SECONDS // *** SET SESSION LIFETIME HERE What happens in the sessions table if you are storing in MySQL? Would not the sessions table hold all sessions for 7 days? This would make the sessions table get huge on busy site. Can anyone comment on this? Quote Link to comment Share on other sites More sharing options...
925SILVER4U Posted December 26, 2006 Author Share Posted December 26, 2006 What happens in the sessions table if you are storing in MySQL? Would not the sessions table hold all sessions for 7 days? This would make the sessions table get huge on busy site. Can anyone comment on this? Yes - I have to yet figure another workaround for this; I am not a very good php and I released this hoping it would be improved by others. Quote Link to comment Share on other sites More sharing options...
925SILVER4U Posted December 26, 2006 Author Share Posted December 26, 2006 Nice contribution...one that I felt was always needed in OSCommerce! One thing I noticed is that with the contribution installed, the cart does remain for the customer, but that when the customer returns again to the website the shopping cart shows it is empty (on the first page loaded) until the customer visits their cart. Is there a way to pull the cart info on the first click back into the site? It is a bit missleading... If we can figure out how to retrieve the cart on the first page loaded from the site...it would be better! Keep up the good work!! I am not sure what you mean by this - perhaps its conflicting with another contribution you have - as on my website the customer can see the cart right away. Have a try for yourself: www.925silver4u.com . Quote Link to comment Share on other sites More sharing options...
rabbitseffort Posted January 20, 2007 Share Posted January 20, 2007 works like it should for me, good contribution-- I agree figuring a way for the sql table to not get overloaded will be good--hmmm thanks! Quote "I must admit that I personally measure success in terms of the contributions an individual makes to her or his fellow human beings." ---Margaret Mead--- "The answer is never the answer. What's really interesting is the mystery. If you seek the mystery instead of the answer, you'll always be seeking. I've never seen anybody really find the answer -- they think they have, so they stop thinking. But the job is to seek mystery, evoke mystery, plant a garden in which strange plants grow and mysteries bloom. The need for mystery is greater than the need for an answer. --Ken Kesey" Link to comment Share on other sites More sharing options...
homewetbar Posted August 17, 2014 Share Posted August 17, 2014 Old topic I know, but this has been an issue with oscommerce since the beginning. Been testing this for a few hours, seems like a pretty good solution. Flaw I see though is the cookie expiration does not update when you visit the site again when I view my cookies in Chrome. The session expiration in mysql seems to be renewing, but not the cookie expiration. So, no matter if you visit the site again your session (and cart) is going to be lost after 7 days. I'm thinking of setting the cookie to expire 10 years from now so it is essentially never expires to fix this problem. Any drawbacks to my solution that anyone sees? Quote Most Valuable OsCommerce Contributions: Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294 FedEx Automated Labels -- Contribution 2244 RMA Returns system -- Contribution 1136 Sort Products By Dropdown -- Contribution 4312 Ultimate SEO URLs -- Contribution 2823 Credit Class & Gift Voucher -- Contribution 282 Cross-Sell -- Contribution 5347 Link to comment Share on other sites More sharing options...
Jack_mcs Posted August 18, 2014 Share Posted August 18, 2014 Cookies should not be forced, in my opinion, so I can't answer your question directly. But keep in mind that cookies are stored on the visitors computer and it is common practice to clear them nowadays so setting them for such a long period probably wouldn't make much of a difference. If keeping the customers data over a long period is important to you, you may want to install the auto login addon. That will keep your customers cart until deleted from the shop since it becomes part of their account. Of course, if they delete the cookies, or use a different browser, they won't be logged in. Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
homewetbar Posted November 6, 2014 Share Posted November 6, 2014 Thanks Jack. Second issue I've been encountering is the session table becomes huge, slowing down the site dramtically and backing up mysql processing. We're on a dedicated server with 4 quad processors 16 gb ram so the hardware is likely not the fault. The session table has grown to 20mb One thing we're trying is setting the session to something smaller like 4 hours and the cart cookie to 30 days. In basic testing this seems fine, but I'm worried about other variables I might not be aware of. Will this have any adverse effects? Quote Most Valuable OsCommerce Contributions: Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294 FedEx Automated Labels -- Contribution 2244 RMA Returns system -- Contribution 1136 Sort Products By Dropdown -- Contribution 4312 Ultimate SEO URLs -- Contribution 2823 Credit Class & Gift Voucher -- Contribution 282 Cross-Sell -- Contribution 5347 Link to comment Share on other sites More sharing options...
Jack_mcs Posted November 6, 2014 Share Posted November 6, 2014 I can't think of any problems it might cause, though 4 hours is very low. You may want to look at my Database Optimizer. It allows you to keep the tables, like sessions, to a certain limit. Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons 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.