View Single Post
Old 01-24-2013, 01:44 AM   PM User | #1
jocosity
New to the CF scene

 
Join Date: Jan 2013
Location: Mobile, Alabama
Posts: 1
Thanks: 1
Thanked 0 Times in 0 Posts
jocosity is an unknown quantity at this point
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 )
}
jocosity is offline   Reply With Quote