There are 2 ways to clear the cart--
Add this button to managecart.html:
- Code: Select all
<input onclick="ClearCart(); document.location=('managecart.html')" type="button" class="button" value=" Empty Cart " name="Empty">
Add this function to nopcart.js:
- Code: Select all
//---------------------------------------------------------------------||
// FUNCTION: ClearCart ||
// PARAMETERS: None ||
// RETURNS: null ||
// PURPOSE: To empty the shopping cart ||
//---------------------------------------------------------------------||
function ClearCart(){
SetCookie ('NumberCookies', 0, null, '/');
}
To empty the cart from thankyou.html, without loading the entire nopcart.js and language files, add this between the head tags:
- Code: Select all
<SCRIPT type="text/javascript" language="javascript">
<!--
function ClearCart(){
SetCookie ('NumberCookies', 0, null, '/');
}
function SetCookie (name,value,expires,path,domain,secure) {
document.cookie = name + "=" + escape (value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
//-->
</SCRIPT>
and change the body tag to:
- Code: Select all
<body onLoad="ClearCart();">
If you are asking for credit card information, your checkout must be on a secure server, which is a different domain than the unsecure store server. You will want to clear the cart on the store server that has managecart on it, so place your return page (thankyou.html) on that server, and add the proper path to checkout.pl. There is no need to empty the cart on the secure server, that will be overwritten with the next order, and the customer will never see it.
Remember that these cookies are only session cookies, and only persist as long as the browser is active. Once the browser is closed, there are no more cart content cookies.
Randy