Magento产品列表页加入购物车带数量:在list.phtml中,以list列表模式为例: <?php if($_product->isSaleable()): ?> <p> <form action="<?php echo $this->getAddToCartUrl($_product) ?>" method="post" id="product_addtocart_form_<?php echo $_product->getId()?>"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>> <?php if(!$_product->isGrouped()): ?> <label for="qty"><?php echo $this->__('Qty') ?>:</label> <input type="text" name="qty" id="qty" maxlength="12" value="<?php echo ($this->getMinimalQty($_product)?$this->getMinimalQty($_product):1) ?>" /> <?php endif; ?> <button type="button" onclick="this.form.submit()"><span><span><span><?php echo $this->__('Add to Cart') ?></span></span></span></button> </form> </p> <?php else: ?> <p><span><?php echo $this->__('Out of stock') ?></span></p> <?php endif; ?>(责任编辑:好模板) |