Magento - Change getProductDefaultQty from 0 to 1

Posted by Damodar Bashyal on December 29, 2012

 

In magento product pages at add to cart input field, it shows either 0 or blank. But QA team wanted it to show 1 as default.

<input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />

So this is how it was resolved.

Magento admin > System > Catalog > Inventory > Product Stock Options

Find "Minimum Qty Allowed in Shipping Cart' and click 'Add Minimum Qty' and add a minimum quantity you want to show as default to the appropriate customer group(s) and then save it. It was '1' in my case and assigned to 'All Groups' Customer Group.

There were lots of tips about changing codes to get such result but it worked in my case and was showing 1 as default quantity in the Magento product page add to cart input field without changing single line of magento's core code.

Hopefully it works for you too.

 

 
not published on website


QR Code: Magento - Change getProductDefaultQty from 0 to 1