0

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

  • What do you mean by Order Review Page ?? is it Cart page? – Lalit838 Oct 3 '17 at 6:56
  • not cart order review page – Monu kumar Oct 3 '17 at 12:18
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...!!!

| improve this answer | |
  • not in cart page it is mention above order review page – Monu kumar Oct 3 '17 at 12:18
  • Locate the file from where its rendering using inspect element and add the same to the file. – Lalit838 Oct 3 '17 at 12:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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