Skip to main content
Known Participant
August 17, 2017
Answered

Help Needed Please

  • August 17, 2017
  • 1 reply
  • 773 views

I try create catalogue with buy option and i stuck on the one thing I need to create java script which after clicking on add to cart button will transfer Qty (filed by customer) to last page where is order .At the moment when customer click on cart code, product description and price are transferred just stuck on Qty.

This topic has been closed for replies.
Correct answer Bernd Alheit

That is what i mean but more tricky part is when they press buy.1 should show Qty.1 but when buy.2 Qty.2 etc. Any idea you was so helpful Thanks


Use this:

Quant.value = this.getField("Qty." + added).value;

1 reply

Bernd Alheit
Community Expert
Community Expert
August 17, 2017

What code do you use at the button?

Known Participant
August 17, 2017

This is code for Button

var thename = this.getField(event.target.name);

N = thename.name.substring(4,thename.name.length);

AddToCart(N);

And add to cart function is

function AddToCart(added)

{

this.calculate = false;

var lstItemNum = this.getField("lstItemNum")

var lstItem = this.getField("lstItem")

var lstPrice = this.getField("lstPrice")

IName = lstItem.getItemAt(added-1)

/* original script

var NI = this.getField("TotalNumItems");

NI.value = NI.value+1

var Dest = this.getField("Description."+NI.value)

var INum = this.getField("INum."+NI.value)

var UPrice = this.getField("UPrice."+NI.value)

var Quant = this.getField("Quantity."+NI.value)

var TPrice = this.getField("TPrice."+NI.value)

Dest.value = IName

INum.value = lstItemNum.getItemAt(added-1)

UPrice.value = lstPrice.getItemAt(added-1)

Quant.value = "1"

TPrice.hidden = false

*/

// corrected script

{

var NI = this.getField("TotalNumItems");

NI.value = NI.value+1

var Dest = this.getField("Description."+NI.value)

var INum = this.getField("INum."+NI.value)

var UPrice = this.getField("UPrice."+NI.value)

var Quant = this.getField("Quantity."+NI.value)

var TPrice = this.getField("TPrice."+NI.value)

Dest.value = IName

INum.value = lstItemNum.getItemAt(added-1)

UPrice.value = lstPrice.getItemAt(added-1)

Quant.value = "0"

TPrice.hidden = false

}

// end correction

this.calculate = true

}

Bernd Alheit
Community Expert
Community Expert
August 17, 2017

You must change following line:

Quant.value = "0";

Quant.value = ... insert here the value of the field ... ;