In the post at:
Jobosales says the cart cookie time can be extended by line 33 in/core/sessions.php:
This file is no longer available in the current version. I checked /core/class.session.php and it does not have a hard coded cookie session lifetime.
I have also reviewed other cookie session expiration pots, but the posts are no longer relevant as they reference older/different versions of the cart.
Can someone tell me where the session time is set or how they’ve managed to extend it? My checkout cart seems to clear out after too short a time frame.
Also, I have viewed the cookies using the web developer extension for Firefox to try and determine what session expiration is being set. I see multiple cookies, including one called sess_id. Can anyone confirm which cookie is controlling the checkout cart session lifetime?
In the post at:
There never was a core/sessions.php, but there is a core/class.sessions.php.
However, this is not where that constant is defined. It is defined on line 91 of config.php. If you want to extend the length of a session (time since last activity) then change the multiplier on this line from ‘2’ to some other increment of hours.
2 Hours is insufficient time for your customers to complete checktout?
The cart is stored in $_SESSION[‘cart’]] so it is directly tied to the “user’s session”. If the user clears the session cache in their browser then the session will go away and so will the cart. Same for inactivity. It is the ‘sess_id’ cookie that controls the cart’s SESSION time.
Thank you tbirnseth. That was the clearest and most specific answer I have gotten in the forum and it really helps. Thanks again.
I have been testing my shopping cart expiration times.
Having the cart remain intact (for registered or casual shopper) is important for me.
As a registered user testing the ‘cart’ I haven’t had any entries delete as yet?
I thought the ‘add to cart’ purchases would last 2 hours and then expire?
So far it has been over a week.
BUT … does the time vary from ‘live time’ and ‘storage time’
Is active session time (live time) while you are on the site - 2 Hours?
After 2 hours the cart will expire, if on the site?
While when you are not surfing the site the session time storage is 2 weeks?
After 2 weeks any temporary cart will expire?
My customers have asked for longer session time and longer session storage time.
CONFIG.PHP files I believe are involved
// Session live time
define(‘SESSION_ALIVE_TIME’, SECONDS_IN_HOUR * 2); // 2 hours
// Sessions storage live time
define(‘SESSIONS_STORAGE_ALIVE_TIME’, SECONDS_IN_DAY * 7 * 2); // 2 weeks
Thanks for any help
Good point GNI - my customers have been asking about this too. They’re a bit bewildered that the site ever ‘forgets’ them at all actually - saying things along the line of
[QUOTE]‘but Amazon always knows who I am, what I had in my cart and what I stored in my Wishlist, why don’t you’[/QUOTE]
Talking of the Wishlist - surely the logical place to store the data would be in the database, attached to user accounts? Haven’t been able to find anything current on the forum detailing how the wishlist is coded either…
could there be any security implications for setting the session expiry time to say 1000 hours?
And where would one find the cookies to edit?
Thanks in advance forum gurus ;
You can edit the cookie lifetime in config.php.
There are two session values you might want to change. The first is SESSION_ALIVE_TIME. If you want this greater than 7 days then you will also need to adjust COOKIE_ALIVE_TIME. The second one to adjust is the length of time that Saved Sessions are kept in the DB. For this, you’d adjust SESSIONS_STORAGE_ALIVE_TIME. I’m not quite sure how this one is managed, but I think it’s manged when the user logs in. So in theory, the last session is always available, but may be dumped if SESSIONS_STORAGE_ALIVE_TIME is exceeded.
Probably the easiest/best approach is to increase the value of COOKIE_ALIVE_TIME to “SECONDS_IN_DAY * 360” (or how many days you want) and then change SESSION_ALIIVE_TIME to the same value. This should ensure that the user’s “cart” is available to them when they return to your site. Note that these changes should be well commented so you can easily see them when upgrade conflicts occur.
Regardig wishlist… Wishlists are stored in the DB and are associated with registered users only. Hence, sessions do NOT come into play regarding wishlists.