Community Forums 

Main Content

Re:Add to basket

    Sep 16 2008 16:17:24



    Join date : 2008-09-18      Posts : 3286

    Tracey said: The code I've used to allow customers to add items to their basket without going to the cart is below. However when pressed, although it does add the item to the cart and stays on my site, the 'add to basket' button disappears. Obviously I don't want this to happen. Any ideas?
    <input type="hidden" name="product1" value="1011M Knee Wrap Medium">
    Medium:  <input type="hidden" name="price1" value="41.70">
    <input type="text" name="qty1" size="3">
    <input type="hidden" name="product2" value="1011L Knee Wrap Large">
    Large:  <input type="hidden" name="price2" value="41.70">
    <input type="text" name="qty2" size="3">
    <input name="nocart" type="submit" value="Add to Basket">
    <input name="submit2" type="submit" value="Buy Now">

    I've not tried doing it that way Tracey, I know this way works:

    <p>The pop up is controlled by the button.</p>
    <form action=""; method="post">
    <input type="hidden" name="userid" value="B5124789">
    <input type="hidden" name="nocart">
    <input type="hidden" name="return" value="">;

    <input type="text" name="qty">&nbsp;Peach 1/2 Gal $4.95
    <input type="hidden" name="product" value="Peach Cider 1/2 Gal">
    <input type="hidden" name="price" value="4.95">
    <input type="submit" name="Submit" value="Add to order" onclick="alert('Order has been added to your cart\n\nThis page will refresh');" />

    <p>To use a link/button rather than a form, you could use:</p>

    <p><a href=";product=Peach+Cider+1/2+Gal&amp;qty=1&amp;nocart=1&amp;price=4.95&amp;;qty=1"; onclick="alert('Order has been added to your cart\n\nThis page will refresh');">Add to order</a></p>

    <p><a href="">View your cart/checkout</a></p>


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

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