I just thought I would share something I spent a long time looking for! It should hopefully be more easily found now by others!
This little trick is great for emptying the Cart Contents AND the address details in one click of a button. It is helpful for confused customers to start again and also for operators needing to use the front end for whatever reasons.
We adapted the code slightly to have a button that simply reads 'Reset Order' which we find very useful!
----------------------
Advanced Users Guide
Version 1.2.7
----------------------
Emptying The Cart When People Leave The Checkout
This JavaScript function will empty your customer's shopping cart when they click the 'Cancel' button on the checkout. It is useful as sometimes i
t is confusing for customers if they still have items in their shopping cart, when they think they have cancelled the transaction.
To begin, place the following JavaScript functions in the <head> area of the overall page layout that is being used in the checkout. You can verify this in the 'Checkout Pages Layout' field in 'Settings | Site Options | Layouts'.
Add it in just above the closing </head> tag.
<script language="Javascript" type="text/javascript">
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 CancelOrder() {
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.href = 'http://www.YOURSITE.com/RETURN-PAGE';
}
}
</script>
Replace 'http://www.YOURSITE.com/RETURN-PAGE' with the location of a page you want to take customers to.
Then go to 'Design | Library | Layouts' and locate the 'Checkout Button' group. Within it, locate 'Checkout Cancel Button' and double-click on it to
open it.
Replace the code in the layout with the following:
<input type="button" name="ACTION" value="<actinic:variable
encoding="html" name="CancelButton" />" class="normal-button"
onclick="CancelOrder();" />
This little trick is great for emptying the Cart Contents AND the address details in one click of a button. It is helpful for confused customers to start again and also for operators needing to use the front end for whatever reasons.
We adapted the code slightly to have a button that simply reads 'Reset Order' which we find very useful!
----------------------
Advanced Users Guide
Version 1.2.7
----------------------
Emptying The Cart When People Leave The Checkout
This JavaScript function will empty your customer's shopping cart when they click the 'Cancel' button on the checkout. It is useful as sometimes i
t is confusing for customers if they still have items in their shopping cart, when they think they have cancelled the transaction.
To begin, place the following JavaScript functions in the <head> area of the overall page layout that is being used in the checkout. You can verify this in the 'Checkout Pages Layout' field in 'Settings | Site Options | Layouts'.
Add it in just above the closing </head> tag.
<script language="Javascript" type="text/javascript">
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 CancelOrder() {
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.href = 'http://www.YOURSITE.com/RETURN-PAGE';
}
}
</script>
Replace 'http://www.YOURSITE.com/RETURN-PAGE' with the location of a page you want to take customers to.
Then go to 'Design | Library | Layouts' and locate the 'Checkout Button' group. Within it, locate 'Checkout Cancel Button' and double-click on it to
open it.
Replace the code in the layout with the following:
<input type="button" name="ACTION" value="<actinic:variable
encoding="html" name="CancelButton" />" class="normal-button"
onclick="CancelOrder();" />
Comment