Thanks for the answer.
I have made minimalQuantity like you said, now it is like this:
// The button to increment the product value
$(document).on('click', '.product_quantity_incr', function(e){
e.preventDefault();
fieldName = $(this).data('field-qty');
var currentVal = parseInt($('input[name='+fieldName+']').val());
quantityAvailableT = 100000000;
if (!isNaN(currentVal) && currentVal < quantityAvailableT)
$('input[name='+fieldName+']').val(currentVal + minimalQuantity).trigger('keyup');
else
$('input[name='+fieldName+']').val(quantityAvailableT);
});
// The button to decrement the product value
$(document).on('click', '.product_quantity_decr', function(e){
e.preventDefault();
fieldName = $(this).data('field-qty');
var currentVal = parseInt($('input[name='+fieldName+']').val());
if (!isNaN(currentVal) && currentVal > 1)
$('input[name='+fieldName+']').val(currentVal - minimalQuantity).trigger('keyup');
else
$('input[name='+fieldName+']').val(1);
});
but it is still nothing, I can say that nothing happens when I click + or - button.
I made a modification on your code in product-list.tpl to show minimal quantity in box instead of 1:
<input type="number" min="1" name="qty_{$product.id_product|intval}" id="quantity_to_cart_{$product.id_product|intval}" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}{if $product.minimal_quantity > 1}{$product.minimal_quantity}{else}1{/if}{/if}" />
<a href="#" data-field-qty="qty_{$product.id_product|intval}" class="btn btn-default button-minus product_quantity_decr" style="clear:none;">
<span><i class="icon-minus"></i></span>
</a>
<a href="#" data-field-qty="qty_{$product.id_product|intval}" class="btn btn-default button-plus product_quantity_incr" style="clear:none;">
<span><i class="icon-plus"></i></span>
</a>
And minimal quantity is shown, but I don't think my modification is the problem, because it was the same problem before I made it. On the other side, I have made modification on product.js for the product site to have multiply quantities:
// The button to increment the product value
$(document).on('click', '.product_quantity_up', function(e){
e.preventDefault();
fieldName = $(this).data('field-qty');
var currentVal = parseInt($('input[name='+fieldName+']').val());
if (!allowBuyWhenOutOfStock && quantityAvailable > 0)
quantityAvailableT = quantityAvailable;
else
quantityAvailableT = 100000000;
if (!isNaN(currentVal) && currentVal < quantityAvailableT)
$('input[name='+fieldName+']').val(currentVal + minimalQuantity).trigger('keyup');
else
$('input[name='+fieldName+']').val(quantityAvailableT);
});
// The button to decrement the product value
$(document).on('click', '.product_quantity_down', function(e){
e.preventDefault();
fieldName = $(this).data('field-qty');
var currentVal = parseInt($('input[name='+fieldName+']').val());
if (!isNaN(currentVal) && currentVal > 1)
$('input[name='+fieldName+']').val(currentVal - minimalQuantity).trigger('keyup');
else
$('input[name='+fieldName+']').val(1);
});
And on product side it works perfectly. Do you know what I'm doing wrong? Maybe I have to add something else? Or in the other place? Please answer.