Commit b60c351d by dhn

修复购物车加减商品重复的bug

parent 7ca2914d
......@@ -79,5 +79,32 @@
<input type="hidden" value="" id="update_cart_action_container" data-cart-item-update=""/>
</div>
</form>
<script>
require(['jquery'], function ($) {
$('.add-qty').click(function(){
var input = $(this).prev().find('.input-text');
if (input.val()) {
var current = parseInt(input.val());
input.val(current + 1);
// submit
$("#form-validate").submit();
} else {
return false;
}
});
$('.lower-qty').click(function(){
var input = $(this).next().find('.input-text');
if (input.val() > 1) {
var current = parseInt(input.val());
input.val(current - 1);
// submit
$("#form-validate").submit();
} else {
return false;
}
});
});
</script>
<?= $block->getChildHtml('checkout.cart.order.actions') ?>
<?= $block->getChildHtml('shopping.cart.table.after') ?>
......@@ -139,30 +139,4 @@ $canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinima
</td>
</tr>
</tbody>
<script>
require(['jquery'], function ($) {
$('.add-qty').click(function(){
var input = $(this).prev().find('.input-text');
if (input.val()) {
var current = parseInt(input.val());
input.val(current + 1);
// submit
$("#form-validate").submit();
} else {
return false;
}
});
$('.lower-qty').click(function(){
var input = $(this).next().find('.input-text');
if (input.val() > 1) {
var current = parseInt(input.val());
input.val(current - 1);
// submit
$("#form-validate").submit();
} else {
return false;
}
});
});
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment