Community Forums 

Main Content

Using quantity discount feature

    Sep 03 2010 20:46:58

    #1

    Yukon4

    Join date : 2008-09-18      Posts : 67

    I followed the instructions I found in another post for adding a script to your page so that the discountpr tallies up the cumulative sum of all the items and calculates the appropriate discounts (and I can't find that post -- hence this new post!)

    I have used the add.cfm and checked that my form tag is closed, yet it's not working and I get the "your cart is empty" message. Here is the draft of that page:

    http://www.soapmolds.com/silicone_soapmolds_bulk.html

    When you purchase a total of 25, or more, of any combination of molds, the price is $13.50 each. If you buy LESS than 25 molds, the price is $17 each. I can't see what I'm doing wrong -- any help would be greatly appreciated! Thanks!



    Sep 03 2010 22:04:36

    #2

    Debbie Q

    Join date : 2008-09-18      Posts : 4994

    I don't have time to test this out but with a quick look I see that the second line of the item has something written inside the brackets making it not be included in the tally. Yours just has product[] for both lines. Test it and see if that is the problem.

    <input type="text" name="product[]" size="2" onKeyUp="tally(this)">Number of boxes of 'Foil Light - Standard'
    <input type="hidden" name="product[Standard]" value="Foil Light Standard">

    Debbie Q

    Mal's Support: www.mals-e.com/support.php
    GT's Forms and examples: www.malsforms.com
    Helpful java scripts: www.gemasana.com/mals
    Shipping help documents: www.stoner.org.uk/mals

    My Create-A-Book Publishing - mycreateabook.com
    Personalized Books, Music CDs and Gifts for all ages and occasions.

    Please help me out and share my site on your networks.




    Sep 03 2010 22:57:14

    #3

    Yukon4

    Join date : 2008-09-18      Posts : 67

    Hmmm, no, that made no difference. So for each product (I've only done the top 2 in this manner) I have:

    <FORM action="http://ww4.aitsafe.com/cf/add.cfm"; method="post" >
    <input type="hidden" name="userid" value="69243506" />
    <input type="hidden" name="return" value="http://www.soapmolds.com">;
    <input type="hidden" name="qty">
    <INPUT TYPE="HIDDEN" NAME="discountpr" VALUE="24,17.00:1,13.50:0,13.50">


    <INPUT TYPE="TEXT" NAME="product[]" size="2" onKeyUp="tally(this)"><span class="descriptions">Kudos Angels Gather</span>
    <INPUT NAME="product[Kudos Angels Gather]" TYPE="HIDDEN" id="product[Kudos Angels Gather]" VALUE="Kudos Angels Gather">

    <br>
    <INPUT TYPE="TEXT" NAME="product[]" size="2"onKeyUp="tally(this)"><span class="descriptions">Kudos Baby Cow</span>
    <INPUT NAME="product[Kudos Baby Cow Mold]" TYPE="HIDDEN" id="product[Kudos Baby Cow Mold]" VALUE="Kudos Baby Cow Mold">


    Plus this script in the head section of the page:

    <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>


    --- and a closing form tag at the end of it. I really can't see what's missing, but it still says "your cart is empty". Help!



    Sep 04 2010 07:29:17

    #4

    GT

    Join date : 2008-09-18      Posts : 3207

    I see you've introduced 180 errors into that page: http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.soapmolds.com%2Fsilicone_soapmolds_bulk.html

    Your google style sheet is throwing the tables out, making the page around 5 miles wide.

    I see you've modified the script and haven't followed other form examples.

    I've spent two hours and rebuilt your page.

    If you'd like to make a donation through the Mal's forms page, I'll give you the URL to your new working page.

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

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