0

I put the form for the checkbox how many items the user want to buy:

<?php $haveProds = $this->getHaveProducts();?>
            <?php if($_product->isAvailable() && $haveProds) { ?>
                <div class="mergeContainer">
                    <?php if(!$_product->isGrouped()): ?>
                    <label for="qty">Wählen Sie Ihre gewünschte Menge</label>
                    <?php endif; ?>
                    <select name="qty" id="qty">
                      <?php $i = 1 ?>
                      <?php do { ?>
                        <option value="<?php echo $i?>">
                          <?php echo $i?>
                          <?php $i++ ?>
                        </option>
                        <?php } while ($i <= (int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getMaxSaleQty()) ?>
                    </select>
                    <?php if ($_product->isSaleable() && $this->hasOptions()):?>
                        <?php echo $this->getChildChildHtml('container1', '', true, true) ?>
                    <?php endif;?>
                    <?php if ($_product->isSaleable() && $this->hasOptions()):?>
                        <?php echo $this->getChildChildHtml('container2', '', true, true) ?>
                    <?php endif;?>
                </div>
            <?php }?>

from my app/design/frontend/base/default/template/catalog/product/view-adopted.phtml to .../view/addtocart.phtml

so the user will be able to change the quantity directly above the add-to-cart button in the right box.

After that the selected value of the dropdown won't be overtaken in the cart anymore. If I click on "add to cart" now, just one item is added.

Unfortunately I can't find the function that reads this value. Can anyone help me?

Best Vanessa

  • if you use the developer tools in your browser, what is the url that the add to cart button is using, including the parameters. – David Manners Jul 21 '14 at 7:22
  • onclick function is: productAddToCartForm.submit(this), URL is: http://lenas-tulpenbaum.localhost/checkout/cart/add/uenc/aHR0cDovL2xlbmFzLXR1bHBlbmJhdW0ubG9jYWxob3N0L3Jvc2UuaHRtbD9fX19TSUQ9VQ,,/product/381/ – Vanessa Böhner Jul 21 '14 at 7:48
  • Is this qty drop down inside the add to cart form? otherwise it wont work – David Manners Jul 21 '14 at 7:50
  • Ah.. no, the form-declaration was still at the old place - I took the form now to the sidebox with the dropdown. Thank you very much! – Vanessa Böhner Jul 21 '14 at 8:03
1

So that we have an answer here.

What you should do is have this quantity field inside the add to cart form so that the button action productAddToCartForm.submit(this) will be able to load the requested quantity information and pass this to the cart itself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.