Do you want to prevent someone with an order over $1500 from using the
save10 coupon code? Why not let them use it? They're leaving more money on
the table for you, so let them have the smaller discount.

If I View Source I can get the coupon codes? :) I would do a hash on the
coupon code (a simple checksum, or even Tiny Encryption Algorithm, Google
for it) to hide it, then look it up in an array that told you the minimum
subtotal where the code was valid. If the code's has wasn't in the array, or
if subtotal was less than the amount in the array, it's not valid.
 
Where is the discount subtracted? I hope on the server side. Otherwise it
sounds like you're vulnerable to "unauthorized price reductions." If you're
just doing some client-side check that will be reverified at the server,
it's not a problem. 

-----Original Message-----

function checkCoupon() {
        /* check the coupon code function */
        var curCoupon = $('#v_code').val();
        var st = parseInt($('#thesubtotal').html());
        if (st < 1499.99) {
                appcode = 'save10';
        } else if (st > 1499.99 && st < 1999.99) {
                appcode = 'save5freeship';
        } else if (st > 1999.99 && st < 2999.99) {
                appcode = 'save10freeship';
        } else if (st > 2999.99 && st < 5999.99) {
                appcode = 'save15freeship';
        } else if (st > 5999.99) {
                appcode = 'save20freeship';
        } else {
                appcode = 'what?';
        }
        if (curCoupon != '' && curCoupon.toLowerCase() !=
appcode.toLowerCase())  {
                alert('You have entered the incorrect coupon code for your
merchandise total. Your code has been updated.');
                $('#v_code').val(appcode);
        }
}


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to