Magento – Show Quantity Box in Products List
In file ‘list.phtml’ file change the <button> line near line 108 from this:
<?php if($_product->isSaleable()): ?>
<button class="form-button" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?<')">>span>
<?php echo $this->__('Add to Cart') ?></span></button>
with:
<form action="
<?php echo $this->getAddToCartUrl($_product) ?>" method="post" id="product_addtocart_form_<?php echo $_product->getId(); ?>">
<input name="qty" type="text" class="input-text qty" id="qty" maxlength="12" value="
<?php echo $this->getMinimalQty($_product) ?>" />
<button class=form-button" onclick="productAddToCartForm_
<?php echo $_product->getId(); ?>.submit()"><span>
<?php echo $this->__('Add to Cart') ?></span></button>
</form>
<script type="text/javascript">
var productAddToCartForm_
<?php echo $_product->getId(); ?> = new VarienForm('product_addtocart_form_
<?php echo $_product->getId(); ?>');
productAddToCartForm_
<?php echo $_product->getId(); ?>.submit = function(){
if (this.validator.validate()) {
this.form.submit();
}
}.bind(productAddToCartForm_<?php echo $_product->getId(); ?>);
</script>
Hello, here´s flo from Germany.
I´ve searched the whole Internert for any solution but no way.
i´would like to make it possible to give a quanty box at the grid view product category list!
I´ve used the following code in list.phtml:
……………………………………………….
isSaleable()): ?>
<form action="getAddToCartUrl($_product) ?>” method=”post” id=”product_addtocart_form_getId()?>”getOptions()): ?> enctype=”multipart/form-data”>
isGrouped()): ?>
__(‘Qty’) ?>:<input type="text" name="qty" id="qty" maxlength="12" value="getMinimalQty($_product)?$this->getMinimalQty($_product):1) ?>” class=”qty inputstyled” style=”margin: 4px 10px 4px 5px;” />
__(‘Add to Cart’) ?>
………………………………………………..
This works great, but i would like to giv with one add to cart click more artikels then one.
For example i will add with only on add-to-cart button click this following all things
7 T-Shirts in blue, 4 T-Shirts in yellow and 2 T-Shirts in green
Which changes sould i have to do??
Could any one help me! I´m using Magento 1.8.1 CE
Many Thanks for solutions,
Best Regards from Germany!