Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > shopping cart problem

Reply
Thread Tools

shopping cart problem

 
 
fiona
Guest
Posts: n/a
 
      05-26-2006
Be grateful if someone could help me out with this.
I'm working on a shopping cart where I want the choice of adding four
different items to it
What's happining at the moment is when I add something from the top box
named productid id it adds the item to the cookie.
when I try to add something from any other "productid" it still adds
the
first item quantity to the cart
Now, I imagine this is because I have the variables all named the
same, but
I don't know how to change it do i add in
four variables in place of the "id" variable now?

Thanks for any help



function setCookie1()
{
alert("Setting the cookie");
alert("Quantity:"+document.purchaseForm.priceText. value);
// var id = prompt("What's your product ID?","");

//var qty = prompt("What's the quantity?", "");

id = document.purchaseForm.productId.value;
qty = document.purchaseForm.priceText.value;
var previousCookie= document.cookie; //retrieve cookies held

var previousData = unescape(previousCookie);

var newData = id +":" + qty;
newData = newData+"/"+previousData;

var cookie1 = escape(newData);

document.cookie = cookie1;

}

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
shopping cart problem =?Utf-8?B?Q2hpV2hpdGVTb3g=?= ASP .Net 5 01-29-2007 05:39 PM
Help ! Shopping Cart Problem Phil McKraken Javascript 17 11-02-2005 12:58 PM
Perl Shopping Cart Scripts GeorgeF Perl 1 05-22-2005 04:41 AM
Help with shopping cart problem Randi Javascript 1 04-03-2004 09:30 PM
simple shopping cart problem Randi Javascript 3 04-02-2004 03:14 PM



Advertisments