Follow Me on Twitter

Follow Me on Twitter

MyApps

An apps to begin With..

How to add quantity box on product listing page in magento

To add quantity box on Product Listing Page you need to edit app/design/frontend/default/YourTheme/template/catalog/product/list.phtml file

Find the below given line

1
<button type="button" title="<?php echo $this->__('Add to Cart') ?>" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>

And just replace it with,

1
2
3
4
5
6
7
<form action="<?php echo $this->getAddToCartUrl($_product) ?>" method="post" id="product_addtocart_form_<?php echo $_product->getId()?>"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
 <?php if(!$_product->isGrouped()): ?>
 <label for="qty"><?php echo $this->__('Qty') ?>:</label>
 <input type="text" name="qty" id="qty" maxlength="12" value="<?php echo ($this->getMinimalQty($_product)?$this->getMinimalQty($_product):1) ?>" />
 <?php endif; ?>
 <button type="button" onclick="this.form.submit()"><span><span><span><?php echo $this->__('Add to Cart') ?></span></span></span></button>
 </form>

Comments are currently closed.