Magento Quantity Box in the Category Products Listing Page


in my theme’s /template/catalog/product/list.phtml file
<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="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>
Advertisements

One thought on “Magento Quantity Box in the Category Products Listing Page

  1. Flo says:

    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 use this one with:
    One add to cart click >> Add more artikels in diverent quantys to cart.
    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, to get this running??

    Could any one help me! I´m using Magento 1.8.1 CE

    I know everything about bundle and grouped artikles and i will not have any anthwer: So i should use this! Then i will use it with category product list and not with grouped artikles! Same feature but other solution.

    Many Thanks for solutions,
    Best Regards from Germany!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s