1) Add the one new file called jquery.qty.js and enter the following code
jQuery(document).ready(function(){ jQuery("div.quantity").append('<input type="button" value="+" id="add1" class="plus" />').prepend('<input type="button" value="-" id="minus1" class="minus" />'); jQuery(".plus").click(function() { var currentVal = parseInt(jQuery(this).prev(".qty").val()); if (!currentVal || currentVal=="" || currentVal == "NaN") currentVal = 1; jQuery(this).prev(".qty").val(currentVal + 1); }); jQuery(".minus").click(function() { var currentVal = parseInt(jQuery(this).next(".qty").val()); if (currentVal == "NaN") currentVal = 1; if (currentVal > 1) { jQuery(this).next(".qty").val(currentVal - 1); } }); });and place as per your theme folder structure
2)Add the Following
If you want in cart page open app/design/frontend/default/yourtheme/template/catalog/prdouct/view/addtocart.phtml search for qty code and place div like this
<div class="quantity"> <input name="cart[<?php echo $_item->getId() ?>][qty]" value="<?php echo $this->getQty() ?>" size="2" title="<?php echo $this->__('Qty') ?>" class="input-text qty" maxlength="12" /> </div>
IF u want in view page open app/design/frontend/default/yourtheme/template/checkout/cart/item/default.phtml search for qty code and place div like this
<div class="quantity"> <input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" /> </div>
Just check you will get the incerement box in cart and view page
Hope this will help you!
No comments:
Post a Comment