Here's my script :
//event handler for item quantity in shopping cart
function itemQuantityHandler(p, a) {
//get current quantity from cart
var filter = /(\w+)::(\w+)/.exec(p.id);
var cart_item = cart[filter[1]][filter[2]];
var v = cart_item.quantity;
//add one
if (a.indexOf('add') != -1) {
if(v < settings.productBuyLimit) v++;
}
//substract one
if (a.indexOf('subtract') != -1) {
if (v > 1) v--;
}
//update quantity in shopping cart
$(p).find('.item-quantity').text(v);
//save new quantity to cart
cart_item.quantity = v;
//update price for item
$(p).find('.item-price').text((cart_item.price*v).toFixed(settings.numberPrecision));
//update total counters
countCartTotal();
}
What I need is to increase "v" (cart_item.quantity) by more than one. Here, it's using "v++"...but it's only increasing by 1. How can I change this to make it increase by 4 everytime I click on the plus icon?
I tried
v++ +4
But it's not working.
Thank you!
Use a compound assignment operator:
v += 4;