PDA

View Full Version : shopping basket



joeldav
10-19-2006, 10:26 AM
wondering if anyone could help i have the following code



for (var i=1;i<=retrieveCookieCount('TheBasketCode');i++) {
theCode=retrieveCookie('TheBasketCode',i,0);
theName=retrieveCookie('TheBasketName',i,0);
theWeight=retrieveCookie('TheBasketWeight',i,0);
theTaxable=retrieveCookie('TheBasketTaxable',i,0);
thePrice=retrieveCookie('TheBasketPrice',i,0);
theAP=retrieveCookie('TheBasketAdvanced',i,0);
theQuantity=retrieveCookie('TheBasketQuantity',i,0);
if (theAP!='none') {
tempprice=getAdvanced(theAP,theQuantity);
if (tempprice>'') { thePrice=tempprice; }
}
itemtotal=eval(theQuantity)*eval(getPrice(thePrice));
totprice=totprice+itemtotal;
if (theTaxable==0) taxablestandard=taxablestandard+itemtotal;
if (theTaxable==1) taxablesecond=taxablesecond+itemtotal;
totalforshipping=totalforshipping+eval(theQuantity);
document.writeln("<td bgcolor=#DBF2FA><font face='Arial,Helvetica' size=2 color=#000000>"+theCode+"</font></td>");
document.writeln("<td bgcolor=#DBF2FA><font face='Arial,Helvetica' size=2 color=#000000>"+theName+"</font></td>");
document.writeln("<td bgcolor=#DBF2FA align=right><font face='Arial,Helvetica' size=2 color=#000000>"+theQuantity+"</font></td>");
document.writeln("<td bgcolor=#DBF2FA align=right><font face='Arial,Helvetica' size=2 color=#000000>"+showPrice(thePrice)+"</font></td>");
singlefield=singlefield+""+theName+"&nbsp;&nbsp;"+theQuantity+"&nbsp;&nbsp;"+showPricePlain(getPrice(thePrice))+"<br>";
document.writeln("<td bgcolor=#DBF2FA align=right><font face='Arial,Helvetica' size=2 color=#000000>"+showPriceSingle(itemtotal)+"</font></td>");
document.writeln("</tr>");
document.writeln("<input type=hidden name='basketcontents' value='"+(theCode)+" - "+(theName)+"'>");
}



the last line i have added a hidden field



document.writeln("<input type=hidden name='basketcontents' value='"+(theCode)+" - "+(theName)+"'>");


i need this to write all of the basket products in this field, at the moment it is just putting the last product.

any help appreciated.