Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Display quantity field on product listing
 
zmove
Guru
 
Total Posts:  317
Joined:  2008-04-30
 

Hi,

My question is pretty simple, I would like to add the quantity field on the product listing, but I don’t know how to do.

I know that the code is in catalog/product/list.phtml file, I already tweaked it to change some things, but I don’t know how to add the quantity field with the add to cart button.

Thanks

zmove

 
Magento Community Magento Community
Magento Community
Magento Community
 
zmove
Guru
 
Total Posts:  317
Joined:  2008-04-30
 

I searched long time in the forum with no results, I’m very surprised that nobody needs to do that…

 
Magento Community Magento Community
Magento Community
Magento Community
 
brendanb
Mentor
 
Total Posts:  1093
Joined:  2008-07-16
London, United Kingdom
 

hey,

ok in your list.phtml file
after <?php if($_product->isSaleable()): ?> around line 90
do this

<?php if($_product->isSaleable()): ?>
                
<form action="<?php echo $this->getAddToCartUrl($_product) ?>" method="post" id="product_addtocart_form">                               
                    
<?php if(!$_product->isGrouped()): ?>                                 
                    
<span class="addToBox">
                    
<?php echo $this->__('Qty:'?> <input name="qty" type="text" class="input-text qty" id="qty" maxlength="5" value="<?php echo $this->getMinimalQty($_product)== null?1:$this->getMinimalQty($_product) ?>"/> 
                    
<?php endif; ?> 
                    
<button class="form-button" type="submit"><?php echo $this->__('Add to Cart'?></button>
                    </
span>
                </
form>             
            
<?php else: ?>

hth
brendan

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top