Jump to content

Edit History

pad420

pad420

I fixed it by changing the form to this

 

<form action="{$urls.pages.cart}" method="post" class="mini-form-add">
                        <input type="hidden" name="token" value="{$static_token}">
                        <input type="hidden" value="{$product.id_product}" name="id_product">
                        {if $product.add_to_cart_url}
                            <div class="add-to-cart-input-group">
                                <div class="qty">
                                    <span class="minus">-</span>
                                    <input type="number" class="count" name="qty" min="1" value="1">
                                    <span class="plus">+</span>
                                </div>

                                <button data-button-action="add-to-cart" class="btn btn-primary btn-mini-add" {if !$product.add_to_cart_url}disabled{/if}>
                                    {l s='Add to cart' d='Shop.Theme.Actions'}
                                </button>

                            </div>
                        {/if}
                    </form>

And then adding custom javascript like so

      $(document).ready(function () {

            $(document).on("click", ".plus", function () {
              var t = $(this).closest(".qty").find(".count");
              t.val(parseInt(t.val()) + 1);
            });
            $(document).on("click", ".minus", function () {
              var t = $(this).closest(".qty").find(".count");
              t.val(parseInt(t.val()) - 1);
              0 == t.val() && t.val(1);
            });
            
      });

 

pad420

pad420

I fixed it by changing the form to this

 

<form action="{$urls.pages.cart}" method="post" class="mini-form-add">
                        <input type="hidden" name="token" value="{$static_token}">
                        <input type="hidden" value="{$product.id_product}" name="id_product">
                        {if $product.add_to_cart_url}
                            <div class="add-to-cart-input-group">
                                <div class="qty">
                                    <span class="minus">-</span>
                                    <input type="number" class="count" name="qty" min="1" value="1">
                                    <span class="plus">+</span>
                                </div>

                                <button data-button-action="add-to-cart" class="btn btn-primary btn-mini-add" {if !$product.add_to_cart_url}disabled{/if}>
                                    {l s='Add to cart' d='Shop.Theme.Actions'}
                                </button>

                            </div>
                        {/if}
                    </form>

And then adding custom java script like so

      $(document).ready(function () {

            $(document).on("click", ".plus", function () {
              var t = $(this).closest(".qty").find(".count");
              t.val(parseInt(t.val()) + 1);
            });
            $(document).on("click", ".minus", function () {
              var t = $(this).closest(".qty").find(".count");
              t.val(parseInt(t.val()) - 1);
              0 == t.val() && t.val(1);
            });
            
      });

 

×
×
  • Create New...