Source : How to add quantity option to each product item in the category list page?.
Dans le fichier /app/design/frontend/rwd/default/template/catalog/product.list.phtml repérer la ligne suivante (bouton d’ajout au panier) :
1 |
<button type="button" title="<?php echo $this->__('Add to Cart') ?>" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button> |
Et la remplacer par :
1 2 3 4 5 6 7 8 9 |
<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()): ?> <div class="qty-wrapper"> <label for="qty" class="hidden"><?php echo $this->__('Qty') ?>:</label> <input type="text" pattern="\d*" name="qty" id="qty" maxlength="12" value="<?php echo max($this->getProductDefaultQty() * 1, 1) ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" /> </div> <?php endif; ?> <button type="button" onclick="this.form.submit()" class="button btn-cart"><span><span><span><?php echo $this->__('Add to Cart') ?></span></span></span></button> </form> |