Support » Plugin: Simple Cart & Buy Now » [Plugin: Simple Cart & Buy Now] Add to Cart without reloading page?

  • Resolved r1987

    (@r1987)


    Hello.

    Just a staight question to everyone, that is using this plugin.

    is there a way to ajaxify the Add to Cart button also? Like so, that when i click on the Add to Cart it wouldn’t redirect me to the single.php page of the product, but changes the number of items in the cart with out reloading the page?

    http://wordpress.org/extend/plugins/simple-cart-buy-now/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author bluey80

    (@bluey80)

    I don’t know how to do that, but it would nice. Code suggestions welcome.

    r1987

    (@r1987)

    OK.

    But can you say, what’s the action for adding an item? When I click on the add to cart button, it redirects me to the single page of the product.

    When im at the checkout page, and i click remove, then i can see that the request for removing an item is ?remove=product_name . I tried to use ?add_item=product_name and that doesn’t add anything to the cart.

    As much as i’ve been searching around the AJAX thing, then it needs an ?add_item request to add the product to the cart at the background.

    Plugin Author bluey80

    (@bluey80)

    It is a form. Using my site (iguanaworks.net) as a reference, here’s the relevent form for adding a part:

    <form method='post' class='wired-receiver' action='http://iguanaworks.net/products/usb-accessories/ir-receivers/'>
    <input type='hidden' value='add_item' name='action'/>
    <input type='hidden' class='item_url' value='http://iguanaworks.net/?page_id=206' name='item_url'/>
    <input type='hidden' value='wired-receiver' name='item_id'/>
    <input type='hidden' class='item_name' value='Wired Receiver' name='item_name'/>
    <input type='hidden' class='item_price' value='7' name='item_price'/>
    <input type='hidden' class='item_shipping' value='' name='item_shipping'/>
    <input type='hidden' class='item_weight' value='' name='item_weight'/>
    <p id='cartname'>Wired Receiver</p><p id='cartcontent'>Unit Price: $7.00 each<br/>Qty: <input type='text' class='item_qty' value='1' size='2' name='item_qty'/>
    <input type='submit' id='wired-receiver' class="add" name='add' value='Add To Cart'/>
    </form>

    The action points to the current page you are on. Then a bunch of hidden name/value pairs: action:add_item; item_url:http://blah;item_price:7;
    etc

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Simple Cart & Buy Now] Add to Cart without reloading page?’ is closed to new replies.