Categories

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

Display default Add to cart quantity in magento

magento系统默认的add to cart框的数量是空的,其实默认的值为1,但是没有显示出来,可以通过这样的方法让magento add to cart 显示默认数量

修改的文件位于你所使用的magento模板文件夹所在的位置。
一般在template/catalog/product/view/addtocart.phtml
把下面的代码替换成下下面的代码就OK

<input name=”qty” class=”input-text qty” id=”qty” maxlength=”12″ value=”<?php echo $this->getMinimalQty($_product) ?>” type=”text” />

and replace it with:

<input name=”qty” class=”input-text qty” id=”qty” maxlength=”12″ value=”<?php if($_product->isSaleable()): ?>
<?php echo $this->getMinimalQty($_product)== null?1:$this->getMinimalQty($_product) ?>
<?php else: ?>
<?php echo $this->getMinimalQty($_product)== null?0:$this->getMinimalQty($_product) ?>
<?php endif; ?>” type=”text” />

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>