beautyfiend
07-04-2009, 11:24 AM
Hello again,
I have created a store with a basket and checkout but I dont have a 'delete' what's in your basket.
I have looked around and can't find anything.
I assume I have to make a delete all cookies function?
Any help would be greatly appreciated!
Thank you.
This is all the JS for my basket page:
<script language=JavaScript>
var cart = document.cookie;
function getCookie(name)
{
var index = cart.indexOf(name + "=");
if (index == -1) return null;
index = cart.indexOf("=", index) + 1;
var endstr = cart.indexOf(";", index);
if (endstr == -1) endstr = cart.length;
return unescape(cart.substring(index, endstr));
}
var today = new Date();
var expiry = new Date(today.getTime() + 28 * 24 * 60 * 60 * 1000); // plus 28 days
function setCookie(name, value)
{
if (value != null && value != "")
document.cookie=name + "=" + escape(value) + "; expires=" + expiry.toGMTString();
cart = document.cookie;
}
var kill = getCookie("kill") || 0;
var lost = getCookie("lost") || 0;
var call = getCookie("call") || 0;
var et = getCookie("et") || 0;
var casa = getCookie("casa") || 0;
var blood = getCookie("blood") || 0;
var david = getCookie("david") || 0;
var bob = getCookie("bob") || 0;
var beatles = getCookie("beatles") || 0;
var total = 25 * kill + 8* lost + 28 * call + 9 * et + 5 * casa + 11 * blood + 7 * david + 4 * bob + 13 * beatles;
function getValues()
{
with (document.submitForm) {
kill.value = kill;
lost.value = lost;
call.value = call;
et.value = et;
casa.value = casa;
blood.value = blood;
david.value = david;
bob.value = bob;
beatles.value = beatles;
total.value = total;
}
}
</script>
I have created a store with a basket and checkout but I dont have a 'delete' what's in your basket.
I have looked around and can't find anything.
I assume I have to make a delete all cookies function?
Any help would be greatly appreciated!
Thank you.
This is all the JS for my basket page:
<script language=JavaScript>
var cart = document.cookie;
function getCookie(name)
{
var index = cart.indexOf(name + "=");
if (index == -1) return null;
index = cart.indexOf("=", index) + 1;
var endstr = cart.indexOf(";", index);
if (endstr == -1) endstr = cart.length;
return unescape(cart.substring(index, endstr));
}
var today = new Date();
var expiry = new Date(today.getTime() + 28 * 24 * 60 * 60 * 1000); // plus 28 days
function setCookie(name, value)
{
if (value != null && value != "")
document.cookie=name + "=" + escape(value) + "; expires=" + expiry.toGMTString();
cart = document.cookie;
}
var kill = getCookie("kill") || 0;
var lost = getCookie("lost") || 0;
var call = getCookie("call") || 0;
var et = getCookie("et") || 0;
var casa = getCookie("casa") || 0;
var blood = getCookie("blood") || 0;
var david = getCookie("david") || 0;
var bob = getCookie("bob") || 0;
var beatles = getCookie("beatles") || 0;
var total = 25 * kill + 8* lost + 28 * call + 9 * et + 5 * casa + 11 * blood + 7 * david + 4 * bob + 13 * beatles;
function getValues()
{
with (document.submitForm) {
kill.value = kill;
lost.value = lost;
call.value = call;
et.value = et;
casa.value = casa;
blood.value = blood;
david.value = david;
bob.value = bob;
beatles.value = beatles;
total.value = total;
}
}
</script>