Hello all,
On one of our sites we have a function that clears the order details by resetting the cookie for the cart and also related a shipping feature I have implemented.
However, we have had reports of it not clearing the order at times. Basically it should reset the ACTINIC_CART, CART_CONTENT and CART_TOTAL cookies to values of "" with expiry dates of 2 days ago.
If you add an item to the cart it should produce a link on the Order Summary saying 'Clear Order'. Clicking this should reload the page, having cleared the cookies.
Can a few of you please try this out, to see if it causes any noticeable failures? I have tested it in IE, Netscape, Mozilla and Opera and cannot get it to fall over.
The 'View Cart' page should state that the order is empty after pressing the link.
Your thoughts are appreciated.
Thank you. The code that runs this is below:
function createCookie(name,value,days)
{
if (days)
{
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function ClearDetails()
{
if (confirm('This will clear your order and address details completely.\nClick "View Cart" to change your order.\nDo you wish to proceed?') == true)
{
createCookie("ACTINIC_CART","",-2);
createCookie("CART_CONTENT","",-2);
createCookie("CART_COUNT","",-2);
createCookie("CART_TOTAL","",-2);
createCookie("ACTINIC_BUSINESS","",-2);
createCookie("ACTINIC_REFERRER","",-2);
window.location.reload();
}
}
On one of our sites we have a function that clears the order details by resetting the cookie for the cart and also related a shipping feature I have implemented.
However, we have had reports of it not clearing the order at times. Basically it should reset the ACTINIC_CART, CART_CONTENT and CART_TOTAL cookies to values of "" with expiry dates of 2 days ago.
If you add an item to the cart it should produce a link on the Order Summary saying 'Clear Order'. Clicking this should reload the page, having cleared the cookies.
Can a few of you please try this out, to see if it causes any noticeable failures? I have tested it in IE, Netscape, Mozilla and Opera and cannot get it to fall over.
The 'View Cart' page should state that the order is empty after pressing the link.
Your thoughts are appreciated.
Thank you. The code that runs this is below:
function createCookie(name,value,days)
{
if (days)
{
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function ClearDetails()
{
if (confirm('This will clear your order and address details completely.\nClick "View Cart" to change your order.\nDo you wish to proceed?') == true)
{
createCookie("ACTINIC_CART","",-2);
createCookie("CART_CONTENT","",-2);
createCookie("CART_COUNT","",-2);
createCookie("CART_TOTAL","",-2);
createCookie("ACTINIC_BUSINESS","",-2);
createCookie("ACTINIC_REFERRER","",-2);
window.location.reload();
}
}
Comment