Hi,
Hoping someone might be able to help.
I am pretty new to Javascript, but am learning and will get there some day.
The first ‘if’ statement works where it gives a 10% discount if the conditions are met.
In the second ‘if’ statement, I am trying to put a discount of 100bucks off if you purchase more than 11 of the items and obviously the other conditions are met.
I want the new price to sit in ‘totalprice’
[CODE] if(bbclubmember==1 && priceArr[cnt][5]==1)
{
discount +=(itemprice * 0.01); // 10 percent discount for club members
if(itemprice>0)
{
UTMI += “UTM:I|” + dateid +”|”+namer+”|”+namer+”|”+namer+”|n”+filler((priceArr[cnt][3] * 0.9),2)+”|”+ numberofitem +”n”;
}
}
if(bbclubmember==1 && priceArr[cnt][5]==2 && totalnum >11)
{
discount +=(itemprice – 100); // 100 bucks discount for club members
if(itemprice>0)
{
UTMI += “UTM:I|” + dateid +”|”+namer+”|”+namer+”|”+namer+”|n”+filler(priceArr[cnt][3],2)+”|”+ numberofitem +”n”;
}
}
totalprice += itemprice;
I thought I should just be able to put ‘discount +=(itemprice – 100);’ to take 100bucks of the total price but instead it puts the final price as ‘100’. The rest of the statement seems to work as it doesn’t start putting a discount in until you select ’12’ or over as the number of items.
What it does is:
Say 15 items are $900,
It will have: Total amount = $900
Total Discount = $800
Net Amount to Pay = $100
Where I want: Total Amount = $900
Total Discount = $100
Net Amount to Pay = $800
I hope this is enough for you to help me out, I have taken fully functional script to slightly edit so it all works well apart from this, of course there may well be something obvious in another part of the script that I a missing. I basically copied the first ‘if’ and tried to slightly adjust it to sort out another ‘discount’ scenario.
Any pointers would be much appreciated
Cheers