How can I add quantity option to each product item in the category list page?
By default, you can find this in Magento list.phtml,
<?php if($_product->isSaleable()): ?>
<p><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
<?php else: ?>
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>
So every time you click the Add to Cart button, it is only 1 quantity to be added to the shopping cart.
I want to add this option so the customer can add the quantity they want at this stage,
<?php if(!$_product->isGrouped()): ?>
<input type="text" name="qty" id="qty" placeholder="1" maxlength="12" value="<?php echo $_product->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty input-quantity" />
<?php endif; ?>
The first problem is that <?php echo $_product->getProductDefaultQty() * 1 ?>
always shows the value of 0
.
The second problem is that if I put the quantity value manually to be, say 20, I will still get 1 only for that product item that I have clicked to add to the shopping cart.
Any ideas?