Add Quantity Increment Decrement Buttons In Magento

 

Hello friends todays im share How to Add Quantity Increment Decrement Buttons In Magento

Add Quantity Increment Decrement Buttons In Magento


<?php $_product = $this->getProduct(); ?>
<?php $buttonTitle = $this->__(‘Add to Cart’); ?>
<?php if($_product->isSaleable()): ?>
<div>
<?php if(!$_product->isGrouped()): ?>
<div>
<label for=”qty”><?php echo $this->__(‘Qty:’) ?></label>
<span> <a href=”javascript:void(0)” onclick=decrementQty(‘qty’);”><img src=<?php echo $this->getSkinUrl(‘images/qty_mns_btn.jpg’) ?>” alt=”minus” /></a></span>
<span> <input type=”text” name=”qty” id=”qty” maxlength=”6″ value=”1″ title=”Antal” /></span>
<?php endif; ?>
<span> <a href=”javascript:void(0);” onclick=incrementQty(‘qty’);”><img src=<?php echo $this->getSkinUrl(‘images/qty_plus_btn.jpg’) ?>” alt=”minus” /></a></span>
</div>
<button title=<?php echo $buttonTitle ?>” onclick=”productAddToCartForm.submit(this)”><span><span><?php echo $buttonTitle ?></span></span></button>
<?php echo $this->getChildHtml(”, true, true) ?>
</div>
<?php endif; ?>
<script type=”text/javascript”>
//<![CDATA[
function decrementQty(id) {
var val = parseInt($(id).getValue());
if(val != 1)
document.getElementById(id).value = val - 1;
}
function incrementQty(id) {
var val = parseInt($(id).getValue());
document.getElementById(id).value = val + 1;
}
//]]>
</script>


Deepak Kumar Bind

Success is peace of mind, which is a direct result of self-satisfaction in knowing you made the effort to become the best of which you are capable.

Post a Comment

If you liked this post please do not forget to leave a comment. Thanks

Previous Post Next Post