1

I'm working on a page with Magento! When I try to Add to my Card a product with quantity more than 1, it comes to my Card with quantity 1... How can this problem be solved???

Diti
  • 11
  • 1
  • 2
  • Check admin setting admin>Catalog>Manage Product>select product>Inventory>check Maximum qty for cart – Amit Bera Oct 09 '14 at 14:51
  • Maximum Qty Allowed in Shopping Cart is 10000 If I can explain better: When I select a product, then select quantity 2 or grater and click Add To Card, it comest to my card with quantity 1!!! – Diti Oct 09 '14 at 14:56
  • Do you have any custom extension installed that may cause this issue? – MagePal Extensions Oct 09 '14 at 15:07
  • No I don't have installed any custom extension. I'm using this theme: http://demo.bsetec.com/?bm_default – Diti Oct 09 '14 at 15:08

3 Answers3

4

There are 2 qty input field on your page that been submitted see debug below.

You need to remove one of them

enter image description here

If you take a look at your source you will see two input name qty in your form

<form action="http://bs....." method="post" id="product_addtocart_form">
  ....
   <div class="add_to_box_con">
    <div class="qty_con">
        <div class="add-to-box removeaddcart_con">
             <div class="add-to-cart">
                <label class="qty_label" for="qty">Quantity:</label>
                <div class="qty_pan">
                <input type="text" name="qty" id="qty" maxlength="12" value="1" title="Qty" class="input-text qty">
                <div class="inc add">›</div><div class="dec add">‹</div><div class="inc add">›</div><div class="dec add">‹</div></div>
                <button type="button" title="Add to Cart" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span>Add to Cart</span></span></button>
            </div>
         </div>

 .....  


 <div class="add_to_cart_links_con">
 <div class="add_to_cart_con">
     <div class="add-to-cart">
      <label class="qty_label" for="qty">Quantity:</label>
       <div class="qty_pan">
        <input type="text" name="qty" id="qty" maxlength="12" value="1" title="Qty" class="input-text qty">
.... 
            </form>
MagePal Extensions
  • 13,911
  • 2
  • 33
  • 52
  • Thanks for your answer, but I'm new in magento... Can you explain better how can I do that thing? Thanks again. – Diti Oct 10 '14 at 08:28
  • Turn on template hints see https://support.sweettoothrewards.com/entries/21255937-How-do-I-turn-on-template-path-hints- ... then search for 'name="qty"' to find out which phtml they are in – MagePal Extensions Oct 10 '14 at 13:14
  • I find /qtyincrements.phtml and the code inside it is: /**
    • @see Mage_CatalogInventory_Block_Qtyincrements

    */ ?>

    getProductQtyIncrements()) : ?>
    <div class="product-pricing">
        <?php echo $this->__('%s is available for purchase in increments of %s', $this->getProductName(), $this->getProductQtyIncrements()) ?>
    </div>
    
    – Diti Oct 10 '14 at 16:42
  • Please remember to accept my answer if it solve your issue – MagePal Extensions Oct 17 '14 at 11:54
0

From Magento version 1.8 onwards, you need to add formkey value inside your form.

If formkey is not set in the form, then always the default qty 1 will be added to cart.

Also, if you try to update the qty from cart page, it will not get updated and will always be set to 1.

To solve this issue, add the following code inside the <form > tag:

<?php echo $this->getBlockHtml('formkey'); ?>

This code is similar to:

<input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />

Porduct View Page

app/design/frontend/YOUR_PACKAGE/YOUR_THEME/catalog/product/view.phtml

<form action="<?php echo $this->getAddToCartUrl($_product) ?>" method="post" id="product_addtocart_form">
    <?php echo $this->getBlockHtml('formkey'); ?>

Shopping Cart Page

app/design/frontend/YOUR_PACKAGE/YOUR_THEME/checkout/cart.phtml

<form action="<?php echo $this->getUrl('checkout/cart/updatePost') ?>" method="post">
    <?php echo $this->getBlockHtml('formkey'); ?>
Mukesh Chapagain
  • 5,383
  • 4
  • 37
  • 51
0

Check what is passed with the request. If this is not 1, check for observers which changes this.

There are lots of reasons why this happens.

Fabian Blechschmidt
  • 35,388
  • 8
  • 75
  • 182