magento 默认添加到购物车数量

Magento – Change getProductDefaultQty from 0 to 1

默认数量是 0

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

1 <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.