0

In Item.php file in app/code/core/Mage/CatalogInventory/Model/Stock/ there is the function

checkQuoteItemQty($qty, $summaryQty, $origQty = 0) ...

What is different in qty parameter and summaryQty parameter.

1 Answer 1

0

If you check the function itself, you will find the description of the parameters just above the function.

/**
 * Checking quote item quantity
 *
 * Second parameter of this method specifies quantity of this product in whole shopping cart
 * which should be checked for stock availability
 *
 * @param mixed $qty quantity of this item (item qty x parent item qty)
 * @param mixed $summaryQty quantity of this product
 * @param mixed $origQty original qty of item (not multiplied on parent item qty)
 * @return Varien_Object
 */

So, here $summaryQty is the total number of current product in whole cart. It will consist of all the instances of current product in different parent products.

Suppose you have a simple product added in multiple parent products like in configurable product, in bundle product or in grouped product and a customer buys one from configurable product and one from bundle product, $summaryQty will be the quantity of current simple product from both the parent products.

If the value of $summaryQty exceeds total number of available quantity of the product, it will display error message by below code

if (!$this->checkQty($summaryQty) || !$this->checkQty($qty)) {
    $message = Mage::helper('cataloginventory')->__('The requested quantity for "%s" is not available.', $this->getProductName());
    $result->setHasError(true)
        ->setMessage($message)
        ->setQuoteMessage($message)
        ->setQuoteMessageIndex('qty');
    return $result;
}
4
  • I have add last 1 product qty in cart but when place order it show error. Requested qty is not available. The summaryQty value is 2 when place order. Please suggest me how to fix this issue. Thanks Commented Sep 6, 2017 at 4:58
  • Do you have only one product in cart? Or there is any other product added in cart? Commented Sep 6, 2017 at 5:01
  • Yes I have added only one product in cart and it's stock qty is only one. But when place order on frontend it's showing error. Commented Sep 6, 2017 at 5:11
  • @RakeshPatidar, did you try creating a new product with qty 1 and adding the same in cart? Commented Sep 11, 2017 at 9:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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