Share via E-Mail
Share on Twitter
Share on Facebook
E-junkie Blog
E-junkie FaceBook Page
E-junkie @ Twitter

E-junkie Ecommerce Forums » E-junkie Discussions

Tag Cloud for this topic:

Persistent Cart



epatio
member
Posts: 20


How long will an item stay in the cart after a customer places it in the cart but does not checkout?

A lot of customers seem to use the cart as a "bookmark" to store potential purchases, so the longer it stays in the cart the better


#
POSTED ON: July 17, 2010 @ 11:30 GMT -7




E-junkieNinja
E-Junkie Crew
Posts: 753


The browser cookie created when someone adds a product to the cart is 24 hours. Each time someone adds another product to the cart or clicks the View Cart button, the 24 hour time frame will re-start.


#
POSTED ON: July 17, 2010 @ 11:44 GMT -7




bfjack
member
Posts: 26


How about the opposite? Is there a way to have a button to clear someones cart?


#
POSTED ON: July 17, 2010 @ 19:29 GMT -7




bunkbedking
member
Posts: 159


is it possible to extend the cookie beyond 24 hours - we have a large number of customers who take up to 7 days to complete a purchase, so a longer time frame would be beneficial to them

(we sell tangable goods)


#
POSTED ON: July 18, 2010 @ 15:23 GMT -7




E-junkieGuru
E-Junkie Crew
Posts: 4354


@bfjack:
It's possible to "reset" the cart by deleting the cookie we set in the buyer's browser to keep track of their cart contents. This cookie's name in your case would be 'ej_ejc_cart_id112637' (since your E-junkie client ID is 112637), so any generic JavaScript that can delete a cookie by name will do the trick.

@bunkbedking:
At present the cookie's lifespan is hardcoded at 24 hours for everyone, but Development is investigating to see if there's some way we could make that customizable.


#
POSTED ON: July 18, 2010 @ 19:26 GMT -7




epatio
member
Posts: 20


thanks - that would be great


#
POSTED ON: July 19, 2010 @ 09:31 GMT -7




bfjack
member
Posts: 26


Well, since the way to delete the cookie is to set it to expire in 1970 (or a minute ago), the same script could be used to set it to whatever time you wanted. Myself, for a ticketing application, will be setting it to something like 7 minutes if not deleting.
To delete:
function del_cookie(name) {
document.cookie = name + '=; expires=Thu, 01-Jan-70 00:00:01 GMT;';
}

The "name" is as E-junkieGuru explained above.


#
POSTED ON: July 19, 2010 @ 14:28 GMT -7




E-junkieGuru
E-Junkie Crew
Posts: 4354


Hm, I think you can just flat-out delete the cookie directly without setting an expiration, but your approach could work if you want the cookie to expire in a very short but not immediate timeframe.

We have modified our cart software to allow customizing the number of days before the cart cookie expires in each buyer's browser; just add these lines to your View Cart code on every page, just before the "// -->" line in the standard code you obtained from Seller Admin:

function EJEJC_config() {
EJEJC_CDAYS = 7;
}

You can replace the "7" with however many days you want each buyer's cart to retain its contents; as the Ninja explained above, this expiration period starts counting from the last time the buyer viewed their cart. If you are already using function EJEJC_config(){} for other cart customizations, just add the EJEJC_CDAYS line to your existing customization code anywhere before the closing "}" (but before function EJEJC_shown(){} if you're also using that).


#
POSTED ON: July 19, 2010 @ 18:36 GMT -7




bunkbedking
member
Posts: 159


THANKS!!! - for the speedy fix


#
POSTED ON: July 21, 2010 @ 16:09 GMT -7




bfjack
member
Posts: 26


Hmmm, easier said than done, it would appear. Is there some protection or other method that makes it so my page javascript cannot change the cookie 'ej_ejc_cart_id112637'? My simple solution posted previously not only doesn't work, I determined it's not what I want to happen. Changing the expire date would only delete the cookie when the session is ended. I need to clear it while the user is still on the page. I tried to change the value of the cookie to blank and/or 0 (it's a number right now) to empty the cart, but alerts inserted in the script to read the cookie before and after setting it returns the same number - it seems locked somehow.
The configuration change to set the days to expire is good. I would like to be able to shorten the time to something like 7 minutes. Is there a EJEJC_CMINUTES?
Thanks!


#
POSTED ON: July 29, 2010 @ 20:08 GMT -7




E-junkieNinja
E-Junkie Crew
Posts: 753


We are sorry for the delay in responding to your forum post. It would be possible for us to set that up, it is not currently something that can be done. Why are you looking to have the cart cookie only last minutes?


#
POSTED ON: July 31, 2010 @ 15:46 GMT -7




bfjack
member
Posts: 26


It's a ticketing application. The buyer can select the seats they want and add them to the cart. But if they never go through with a purchase, we can't have the seats they selected stay in their cart for any length of time - they need to become available to others. If they stay for overnight in their cart, the seats they selected may have been sold to someone else. That would be a real mess of multiple sales of the same seat. I want to limit the availability in the cart to something like 7 minutes and then release the seats to other folks. See www.bftix.org as the example.
Thanks!


#
POSTED ON: July 31, 2010 @ 17:15 GMT -7




bfjack
member
Posts: 26


I have nothing against adjusting the cookie in my own code, it doesn't need to be a generally available option. E-junkieGuru suggested that as a solution, but in my testing and multiple attempts and approaches at changing the cookie, I couldn't do it. Perhaps it's just a lack of knowledge on how. None of the following approaches seem to work:

function Set_Cookie( name, value, expires, path, domain, secure ) {
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );
// if the expires variable is set, make the correct expires time, the
// current script below will set it for x number of days, to make it
// for hours, delete * 24, for minutes, delete * 60 * 24
if ( expires )
{
//expires = expires * 1000 * 60 * 60 * 24;
expires = expires * 1000 * 60;
}
//alert( 'today ' + today.toGMTString() );// this is for testing purpose only
var expires_date = new Date( today.getTime() + (expires) );
//alert('expires ' + expires_date.toGMTString());// this is for testing purposes only
alert('new value ' + escape(value));
document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + //expires.toGMTString()
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}

// this deletes the cookie when called
function Delete_Cookie( name, path, domain ) {
if ( Get_Cookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

// This also deletes the cookie at end of session
function del_cookie(name) {
document.cookie = name +
'=; expires=Thu, 01-Jan-70 00:00:01 GMT;';
}

// This deletes the cookie right now
function blank_cookie(name) {
alert(Get_Cookie(name));
Set_Cookie(name,'0','/','.bftix.org');
// or Set_Cookie(name,'0'); neither works
alert(Get_Cookie(name));
}

If you go to the site and select Santaland Diaries, click the 'Start Over' button, you'll see the alerts from a call to blank_cookie.


#
POSTED ON: July 31, 2010 @ 17:54 GMT -7
MODIFIED ON: July 31, 2010 @ 17:56 GMT -7




E-junkieGuru
E-Junkie Crew
Posts: 4354


We really can't provide support for the sort of custom javascript you're trying to implement, so if you're having trouble setting that up, all we can really suggest is hiring a developer to either consult with you or just do it for you. We can recommend the competent, E-junkie-experienced developers listed in our directory here:
http://www.e-junkie.com/ej/developer-directory.htm


#
POSTED ON: August 2, 2010 @ 17:17 GMT -7


You must be logged in to make a post. Please click here to login.

30 Day Money Back Guarantee
PayPal Certified Integration
Google Checkout Certified Integration
Slam the Online Scam