0

Can any one tell me how to add qty increment and decrement button on order review page in magento 1.9.?

2
  • What do you mean by Order Review Page ?? is it Cart page?
    – Lalit838
    Commented Oct 3, 2017 at 6:56
  • not cart order review page
    – Monu kumar
    Commented Oct 3, 2017 at 12:18

1 Answer 1

0

For adding '+' & '-' button on your quantity in magento cart, please Find below code from file -

app\design\frontend[your package][your theme]\template\checkout\cart\item\default.phtml

<input type="text" pattern="\d*" name="cart[<?php echo $_item->getId() ?>][qty]" value="<?php echo $this->getQty() ?>" size="4" data-cart-item-id="<?php echo $this->jsQuoteEscape($_item->getSku()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Qty')) ?>" class="input-text qty" maxlength="12" />

and replace it with

<a href="#" class="minus-item">-</a>
<input type="text" pattern="\d*" name="cart[<?php echo $_item->getId() ?>][qty]" onchange="$('FORM-ID HERE').submit()" value="<?php echo $this->getQty() ?>" size="4" data-cart-item-id="<?php echo $this->jsQuoteEscape($_item->getSku()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Qty')) ?>" class="input-text qty" maxlength="12" />
<a href="#" class="plus-item">+</a>

add two anchors with a class and increment and decrements signs

NOTE- Please look for the FORM-ID HERE ID on your form Tag.

And add the script to the bottom of your page:

<script type="text/javascript">
    $(document).on('click', 'a.minus-item', function(e){
    e.preventDefault();
    input = $(this).next('input');
    newVal = parseInt(input.val())-1;
        if(newVal > 0){
            input.val(newVal);
            $('#FORM-ID HERE').submit();
        }
    });
    $(document).on('click', 'a.plus-item', function(e){
    e.preventDefault();
    input = $(this).prev('input');
    newVal = parseInt(input.val())+1;
        if(newVal > 0){
            input.val(newVal);
            $('#FORM-ID HERE').submit();
        }
    });
</script>

Hope this will help...!!!

2
  • not in cart page it is mention above order review page
    – Monu kumar
    Commented Oct 3, 2017 at 12:18
  • Locate the file from where its rendering using inspect element and add the same to the file.
    – Lalit838
    Commented Oct 3, 2017 at 12:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.