<input type="text" name="quantity[<?php echo $product['key']; ?>]" value="<?php echo $product['quantity']; ?>" size="1" class="form-cart" style="display:none;" id="quan-txt" />
<select value="<?php echo $product['quantity']; ?>" onchange="vvv = $(this).val(); $('#quan-txt').val(vvv); $('#cart-form2').submit(); " >
<?php
for($i=1; $i<=20; $i++) {
if ($i == $product['quantity']) {
echo "<option value='$i' selected>$i шт</option>";
} else {
echo "<option value='$i'>$i шт</option>";
}
}
?>
</select>
<input type="text" name="quantity[<?php echo $product['key']; ?>]" value="<?php echo $product['quantity']; ?>" size="1" class="form-cart" style="display:none;">
<select class="countOrders" value="<?php echo $product['quantity']; ?>" >
<?php for($i=1; $i<=20; $i++):?>
<option value="<?=$i?>" <?=($i == $product['quantity'] ? ' selected="selected"' : '' )?>><?=$i?> шт</option>
<?php endfor;?>
</select>
<span class="input-group-btn">
<button type="button" data-toggle="tooltip" class="btn btn-danger" onclick="cart.remove('<?php echo $product['key']; ?>');"><i class="fa fa-times-circle"></i></button>
</span>
Гдето внизу подключить
<script>
$( document ).ready(function() {
$('.countOrders').on('change', function(e){
$(this).prev().val( $(this).val() );
$('#cart-form2').submit();
})
});
</script>
<input type="text" name="quantity[<?php echo $product['key']; ?>]" value="<?php echo $product['quantity']; ?>" size="1" class="form-cart" style="display:none;"/>
<select class="countOrders" value="<?php echo $product['quantity']; ?>" onchange="$(this).prev().val( $(this).val()); $('#cart-form2').submit(); " >
<?php for($i=1; $i<=20; $i++):?>
<option value="<?=$i?>" <?=($i == $product['quantity'] ? ' selected="selected"' : '' )?>><?=$i?> шт</option>
<?php endfor;?>
</select>
<span class="input-group-btn">
<button type="button" data-toggle="tooltip" class="btn btn-danger" onclick="cart.remove('<?php echo $product['key']; ?>');"><i class="fa fa-times-circle"></i></button>
</span>
<code>
onchange="$(this).prev().val($(this).val()); $('#cart-form2').submit();"