|
Need a little help with a discount code
Hey everyone,
I'm totally new to this and learning as I go - so please bare with me!
I need to add a discount code to my website and I can't seem to get it right.
Using the code "JoeCain" should award the customer a $25 gift certificate.
I tried my best to write the code, but my total amounts to $25 and not the price minus $25.
Here's what I have..(ignore the 'frenchfry' code, that one was written by the man who helped with my site)
switch(discount) {
case 'frenchfry':
discount_amount = 0.10
price = price - (price*discount_amount)
discount_applied = ' <i>(Applied 10% Off)</i>'
break;
case 'JoeCain':
discount_amount = 25
price = price - (price-discount_amount)
discount_applied = ' <i>(Applied $25 Off)</i>'
break;
}
$('#price').html('Price: $'+price+'.00' + discount_applied )
}
|