I modified product multiple add cart VM2.5

Started by jvicious, January 21, 2015, 04:29:19 AM

Previous topic - Next topic

jvicious

Hi, I just modified product multiple add cart VM2.5,

i have problem with jquery >> when i click button plus quality on product1 but all quality product is effect too.

this my code

product : function(carts) {
carts.each(function(){
var cart = jQuery(this),
step = cart.find('input[name="quantity"]'),
addtocart = cart.find('input.addtocart-button'),
plus   = cart.find('.quantity-plus'),
minus  = cart.find('.quantity-minus'),
select = cart.find('select:not(.no-vm-bind)'),
radio = cart.find('input:radio:not(.no-vm-bind)'),
virtuemart_product_id = cart.find('input[name="virtuemart_product_id[]"]').val(),
virtuemart_stock = cart.find('input[name="virtuemart_stock[]"]').val(),
quantity = cart.find('input[name="quantity[]"]');

var Ste = parseInt(step.val());
                    //Fallback for layouts lower than 2.0.18b
                    if(isNaN(Ste)){
                        Ste = 1;
                    }
addtocart.click(function(e) {
Virtuemart.sendtocart(cart);
return false;
});
plus.click(function() {
var Qtt = parseInt(quantity.val());
if(Qtt == virtuemart_stock){
alert('สินค้าในสต๊อกไม่เพียงพอ');
return false;
}
if (!isNaN(Qtt)) {
quantity.val(Qtt + Ste);
Virtuemart.setproducttype(cart,virtuemart_product_id);
}
});
minus.click(function() {
var Qtt = parseInt(quantity.val());
if (!isNaN(Qtt) && Qtt>Ste) {
quantity.val(Qtt - Ste);
} else quantity.val(0);
Virtuemart.setproducttype(cart,virtuemart_product_id);
});
select.change(function() {
Virtuemart.setproducttype(cart,virtuemart_product_id);
});
radio.change(function() {
Virtuemart.setproducttype(cart,virtuemart_product_id);
});
quantity.keyup(function() {
Virtuemart.setproducttype(cart,virtuemart_product_id);
});
});
}
};

https://drive.google.com/file/d/0B_wSaPlPTm3FbzhQRzU5NWFCQjg/view?usp=sharing

Milbo

The problem is solved in the next version, check the svn (I just did that yesterday, lol ))
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/