问题描述
我添加了使用jquery代码增加数量的
I added to increase quantity using jquery code
$(".quantity-adder .add-action").click(function () {
if ($(this).hasClass('add-up')) {
var text = $(this).parent().parent().parent().find("[name=quantity]", '.quantity-adder')
text.val(parseInt(text.val()) + 1);
} else {
var text = $(this).parent().parent().parent().find("[name=quantity]", '.quantity-adder')
if (parseInt(text.val()) > 1) {
text.val(parseInt(text.val()) - 1);
}
}
});
当我在产品页面中添加此代码,并单击加号按钮时,数量增加,并且在单击添加到购物车后其工作正常
when i add this code in product page, and clicking the plus button, quantity increases and when clicked on add to cart its working fine
http://itracktraining.com/optest/index. php?route = product/product& product_id = 40
但同一功能在首页精选功能中不起作用
but same thing is not working in homepage featured one
http://itracktraining.com/optest/index.php?route=普通/家庭
有人可以让我知道是什么原因吗
can some one let me know what could be the reason
推荐答案
cart.add()
函数中的通过数量参数.
Pass quantity parameter in cart.add()
function.
例如: <button type="button" onclick="cart.add('<?php echo $product['product_id']; ?>',$(this).parent().parent().find('input:first').val());"><i class="fa fa-shopping-cart"></i> <span class="hidden-xs hidden-sm hidden-md"><?php echo $button_cart; ?></span></button>
根据您的要求更改相应的值.
Change corresponding values as per your requirements.
实际功能接受两个参数cart.add(product id, quantity);
Actual function accepts two parameterscart.add(product id, quantity);
这篇关于数量数量在Opencart中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!