Community Forums 

Main Content

Re:Quantity discounts for individual items and items in shopping cart

    Feb 12 2009 11:28:24

    #1

    GT

    Join date : 2008-09-18      Posts : 3207

    Try this:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <html>
    <head>
    <title>User entered value plus a discount</title>
    <script type="text/javascript">
    function tally(that){
    result=0;
    for(i=0;i<that.form.elements.length;i++)
    {
    if (that.form.elements.name.indexOf("product[]")>-1){result += that.form.elements.value-0;}
    }that.form.qty.value = result;
    }
    </script>
    </head>

    <body>

    <form action="http://ww12.aitsafe.com/cf/add.cfm"; method="post">
    <input type="hidden" name="userid" value="E0136342">
    <input type="hidden" name="return" value="www.favorplay.com">;
    <input type="hidden" name="units" value="1">
    <input type="hidden" name="qty">
    <input type="hidden" name="discountpr" value="49,1.00:50,.93:100,.83:200,.73">

    <p>Price is 1.00 each, for 50+ is 0.93, for 100+ is 0.83 and for 200+ is 0.73</p>

    <input type="text" name="product[]" size="2" onKeyUp="tally(this)">Shimmering Gold Boxes
    <input type="hidden" name="product[Gold]" value="Shimmering Gold Boxes">
    <br>
    <input type="text" name="product[]" size="2" onKeyUp="tally(this)">Shimmering Silver Boxes
    <input type="hidden" name="product[Silver]" value="Shimmering Silver Boxes">
    <br>
    <input type="text" name="product[]" size="2" onKeyUp="tally(this)">Shimmering Red boxes
    <input type="hidden" name="product[Red]" value="Shimmering Red Boxes">
    <br>
    <input type="submit" value="Buy Your Favor Box">
    </form>

    </body>
    </html>

    Having trouble with a form or need one building?
    Fast turnaround, but I do charge :)

    Mal's Forms / Scripts and the syntax are here.