Quantity input in category page - OPENCART

In catalog/view/theme/"tema ta"/template/product/category.tpl gaseste:

<div class="cart">
        <input type="button" value="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button" />
      </div>

Si inlocuieste cu:

<div class="cart">
     <script type="text/javascript">
     function addQtyToCart(product_id) {
  var qty = $('.item-' + product_id).val();
  if ((parseFloat(qty) != parseInt(qty)) || isNaN(qty)) {
    qty = 1;
  }
  addToCart(product_id, qty);
}
</script>
   Qty:
       <input type="text" value="1" size="2" class="item-<?php echo $product['product_id']; ?>" />
      <input type="button" value="<?php echo $button_cart; ?>" onclick="addQtyToCart('<?php echo $product['product_id']; ?>');" class="button" />
      </div>

Comentarii

Trimiteți un comentariu