letsdance Posted September 10, 2010 Posted September 10, 2010 Hi All, I have trawled through this forum looking for an answer here, but i am yet to find one... Why does the visitors cart contents "have to" disappear when a session expires ..... As far as i can see, the session id remains in the [sessions] table (forever) with the cart contents and everything... After the session expires (after 1440 seconds being idle) and i refresh my page, it uses the same oscid but it clears the basket content in the sessions table....?? I get the feeling i'm missing something here, but i have to ask... (i've been looking at this for the past 3 days... and my head is wrecked!!) Eoin just to note Here is the value in the session record (after it has expired but before i refresh the page) cart|O:12:"shoppingCart":6:{s:8:"contents";a:1:{i:2623;a:1:{s:3:"qty";i:1;}}s:5:"total";d:1.399999999999999911182158029987476766109466552734375;s:6:"weight";d:0;s:6:"cartID";s:5:"64897";s:12:"content_type";b:0;s:6:"sep_id";N;}language|s:7:"english";languages_id|s:1:"1";currency|s:3:"GBP";navigation|O:17:"navigationHistory":2:{s:4:"path";a:0:{}s:8:"snapshot";a:0:{}} <<<<you can see the contents in the basket Now here is the value in the session record after i hit refresh (the session has expired and it has cleared the basket) cart|O:12:"shoppingCart":5:{s:8:"contents";a:0:{}s:5:"total";i:0;s:6:"weight";i:0;s:12:"content_type";b:0;s:6:"sep_id";N;}language|s:7:"english";languages_id|s:1:"1";currency|s:3:"GBP";navigation|O:17:"navigationHistory":2:{s:4:"path";a:1:{i:0;a:4:{s:4:"page";s:9:"index.php";s:4:"mode";s:6:"NONSSL";s:3:"get";a:2:{s:38:"cable-ties-bases_black-cable-ties_html";s:0:"";s:5:"cPath";s:6:"27_301";}s:4:"post";a:0:{}}}s:8:"snapshot";a:0:{}}
letsdance Posted September 10, 2010 Author Posted September 10, 2010 Have i worded this badly??? i would really appreciate some insite.... i'm pulling my hair out here!!
♥FWR Media Posted September 10, 2010 Posted September 10, 2010 session data is only persistent for logged in users. Users who have not logged in lose their cart as the cart data is never saved to the database. Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work.
letsdance Posted September 10, 2010 Author Posted September 10, 2010 where is the cart data stored then for a visitor when he is on the site?
♥FWR Media Posted September 10, 2010 Posted September 10, 2010 where is the cart data stored then for a visitor when he is on the site? It is stored in the _SESSION superglobal, this is cleared when the browser is closed / session expires. Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work.
letsdance Posted September 10, 2010 Author Posted September 10, 2010 Ok, what "if" everytime a visitor adds items to their baskets that it would be added to the database.. using the session_id as a reference? that way even if the session timed out the cart content is still there.
♥FWR Media Posted September 10, 2010 Posted September 10, 2010 Ok, what "if" everytime a visitor adds items to their baskets that it would be added to the database.. using the session_id as a reference? that way even if the session timed out the cart content is still there. Pointless .. session ids are by their nature temporary. In fact security dictates that the session id must change constantly throughout a browsing session. Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work.
letsdance Posted September 10, 2010 Author Posted September 10, 2010 Ok, then here is another thought.... how about a seperate id is added to the cookies... a vistor shopping cart id cookie this will this would refer to the details of the shopping basket and would not be lost even if the session is changed or ended. so even if the user closed their browers, when the opened it again they would return the same cart contents. this would work... wouldn't it?
♥FWR Media Posted September 10, 2010 Posted September 10, 2010 Ok, then here is another thought.... how about a seperate id is added to the cookies... a vistor shopping cart id cookie this will this would refer to the details of the shopping basket and would not be lost even if the session is changed or ended. so even if the user closed their browers, when the opened it again they would return the same cart contents. this would work... wouldn't it? Yes .. the only way to achieve a persistent cart for non logged in users would be to save every non users cart in the database together with a persistent cookie on the users pc. Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work.
♥Monika in Germany Posted September 13, 2010 Posted September 13, 2010 FWR media is perfectly right ... I have done that before on a shop - extensive changes to osCommerce, which is not made for this ;-) :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...
Jitty25 Posted October 1, 2010 Posted October 1, 2010 Maybe you can try contribution Cart Cookie: http://addons.oscommerce.com/info/5390 Or does anyone think that it is not safe to do that? Thanks.
tkeats Posted October 1, 2010 Posted October 1, 2010 The only solution I see for this, is if the shopper is LOGGED IN, you can make a semi-permanent cart, where things dont go poof.. However I think osC already does that... I ran a test last year, came back to test the cart again this year and stuff was still there... A signature is something that reflects its user. - The dictionary The question is not, 'to code, or not to code' the question is, 'if we do not code, are we really alive?' -- anonymous
etzeppy Posted October 8, 2010 Posted October 8, 2010 Maybe you can try contribution Cart Cookie: http://addons.oscommerce.com/info/5390 Or does anyone think that it is not safe to do that? Thanks. I did not code the original version of that add-on but I did update and repackage it. I have been using it for almost a year with no issues. I believe it has helped with sales. I often see visitors return and complete a purchase. The cookie only contains temporary shopping cart data. I am not aware of, nor have I been informed of any security issues.
MrPhil Posted October 9, 2010 Posted October 9, 2010 Yes .. the only way to achieve a persistent cart for non logged in users would be to save every non users cart in the database together with a persistent cookie on the users pc. It would require a permanent cookie on the browser, holding either a unique ID (with the cart contents stored in the database and referenced by that ID) or storing the cart contents itself in the cookie (no trace of it in the database, but there would be limits to cookie size). That wouldn't be too difficult. However, there are some complications. How long do you want to keep merchandise "off the shelf" and in the cart, before giving up on this potential customer? That might be dealt with by restocking the shelves when they leave, and having the merchandise taken off the shelf and put in the cart all over again (per the stored shopping list) when (and if) this customer comes back. This would be something you'd want to do even with registered customers who save a cart, as you don't want inventory tied up sitting in a cart for months or years. If you keep the guest's shopping cart in your database, how long is long enough to keep it there? Even if the merchandise is put back on the shelf immediately, the cart itself is still clogging your database. Remember that the vast majority of guests will probably never come back. And, do you write the cookie as they go, in case they go off to some other site and just forget their cart for a while, or do you ask them if they want it saved? Another matter is privacy. Whoever comes back to your store next on this computer will see your cart. Do you really want your wife seeing that you're buying a DVD of "Naughty Schoolgirls in Heat"? Or do you want to see what the guy who used the library computer ahead of you was shopping for? While a name and address would not be associated with it, it still might be possible to tell whose shopping cart it is. Naturally, only one guest shopping cart could be saved per computer -- otherwise no one could tell whose was whose without looking through all of them! Or, all carts could be encrypted with a password chosen by the guest. That way multiple guest carts could be saved on a PC. However, most guests are likely to forget such a password, and would not like giving a password as soon as they put something in their cart. Instead of saving a guest's shopping cart, maybe there should be a way to email the cart contents (encrypted) to their email account, and the guest could "somehow" import this to a fresh cart on their next visit. Or, download the cart as a file (encrypted, with plain text comment) onto the visitor's USB memory stick? There are lots of issues to think about any time you consider keeping a shopping cart (for registered customer or for a guest) alive beyond the active session.
etzeppy Posted October 9, 2010 Posted October 9, 2010 Another matter is privacy. Whoever comes back to your store next on this computer will see your cart. Do you really want your wife seeing that you're buying a DVD of "Naughty Schoolgirls in Heat"? Or do you want to see what the guy who used the library computer ahead of you was shopping for? That issue is no different with Amazon and many other ecommerce sites that store shopping cart info for some time period (longer than one session). If you want your browsing and shopping to be private, you better know how to keep stuff cleared out, cookies include. I personally find it very annoying to shop at a site and find items that I want to buy, then have to start from scratch when I come back.
letsdance Posted October 13, 2010 Author Posted October 13, 2010 That issue is no different with Amazon and many other ecommerce sites that store shopping cart info for some time period (longer than one session). If you want your browsing and shopping to be private, you better know how to keep stuff cleared out, cookies include. I personally find it very annoying to shop at a site and find items that I want to buy, then have to start from scratch when I come back. yeah i have to agree with this, if you have an issue with privacy or are doing things you don't want other people to see, just clear your cookies/histories.... This logic has been adapted by loads of sucessful sites... amazon,misco.com, dabs.com (you can't even clear your content with dabs... even after you delete your cookies!?) having your cart cleared once your session times out is a bit old school is it not?? its how my site works currently and customers really don't like it. (my customers only create an account/log in when their ready to buy)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.