Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Grouped product] Can´t add simple products to cart if one other is out of stock #22304

Closed
hamplr opened this issue Apr 12, 2019 · 22 comments
Closed
Assignees
Labels
Component: GroupedProduct Event: imagine2019 Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@hamplr
Copy link

hamplr commented Apr 12, 2019

Preconditions (*)

  1. magento 2.2-develop
  2. php 7.1

Steps to reproduce (*)

  • enable the option allow to show products without stock
  • grouped product with more sub items
  • at least one sub items have to be without stock (quantity=0)
  • navigate to the PDS of the grouped product
  • add at least on item of any available sub item
  • if you add the item to the cart the message "Please specify the quantity of product(s)." apears

Expected result (*)

  1. the simple products are added to the cart

Actual result (*)

  1. the message "Please specify the quantity of product(s)." appears
  2. it´s not possible to add a simple product, if one other simple product within the grouped product is out of stock
@m2-assistant
Copy link

m2-assistant bot commented Apr 12, 2019

Hi @hamplr. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@hamplr do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • yes
  • no

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Apr 12, 2019
@larsroettig larsroettig self-assigned this Apr 12, 2019
@m2-assistant
Copy link

m2-assistant bot commented Apr 12, 2019

Hi @larsroettig. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • 6. Add label Issue: Confirmed once verification is complete.

  • 7. Make sure that automatic system confirms that report has been added to the backlog.

@larsroettig
Copy link
Member

@magento-engcom-team give me 2.2-develop instance

@larsroettig
Copy link
Member

@magento-engcom-team give me 2.3-develop instance

@magento-engcom-team
Copy link
Contributor

Hi @hamplr. Thank you for your request. I'm working on Magento 2.2-develop instance for you

@magento-engcom-team
Copy link
Contributor

Hi @larsroettig. Thank you for your request. I'm working on Magento 2.2-develop instance for you

@magento-engcom-team
Copy link
Contributor

Hi @larsroettig. Thank you for your request. I'm working on Magento 2.3-develop instance for you

@magento-engcom-team
Copy link
Contributor

Hi @hamplr, here is your Magento instance.
Admin access: https://i-22304-2-2-develop.instances.magento-community.engineering/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.

@nickpiro
Copy link

Having the same issue in 2.2.8

@larsroettig
Copy link
Member

Hi @nickpiro,
we have a fix as Patch for 2.2.8 currently it is not possible to fix this without breaking the Backward compatiblty. Maybee we will find way but I must ask the Team,

Index: project/src/vendor/magento/module-grouped-product/Model/Product/Type/Grouped.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- vendor/magento/module-grouped-product/Model/Product/Type/Grouped.php
+++ vendor/magento/module-grouped-product/Model/Product/Type/Grouped.php
@@ -338,9 +338,6 @@
         }
         foreach ($associatedProducts as $subProduct) {
             if (!isset($productsInfo[$subProduct->getId()])) {
-                if ($isStrictProcessMode && !$subProduct->getQty()) {
-                    return __('Please specify the quantity of product(s).')->render();
-                }
                 $productsInfo[$subProduct->getId()] = $subProduct->isSalable() ? (float)$subProduct->getQty() : 0;
             }
         }

@celorodovalho
Copy link

celorodovalho commented Apr 23, 2019

I have the same problem here in 2.2.8
Any solution?
This is a blocking issue!

@larsroettig there is a commit for this patch?

@hamplr
Copy link
Author

hamplr commented Apr 23, 2019

No, there´s currently no commit for this patch, but we have the patch in use in our project to solve the problem.

@mallikaverma mallikaverma self-assigned this May 11, 2019
@m2-assistant
Copy link

m2-assistant bot commented May 11, 2019

Hi @mallikaverma. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Verify that the issue is reproducible on 2.2-develop branch.
    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

@mallikaverma
Copy link

@magento-engcom-team give me 2.3-develop instance

@mallikaverma
Copy link

I am working on it

@mallikaverma
Copy link

#imagine2019

@joekersh
Copy link

joekersh commented May 13, 2019

The fix from @larsroettig works for me, i created a preference for that class and then overrode the getProductInfo method:

In your module di.xml:

<preference for="Magento\GroupedProduct\Model\Product\Type\Grouped" type="Vendor\Module\Model\Grouped"/>

New class Vendor\Module\Model\Grouped:

protected function getProductInfo(\Magento\Framework\DataObject $buyRequest, $product, $isStrictProcessMode)
{
    $productsInfo = $buyRequest->getSuperGroup() ?: [];
    $associatedProducts = $this->getAssociatedProducts($product);

    if (!is_array($productsInfo)) {
        return __('Please specify the quantity of product(s).')->render();
    }
    foreach ($associatedProducts as $subProduct) {
        if (!isset($productsInfo[$subProduct->getId()])) {
        	
            // if ($isStrictProcessMode && !$subProduct->getQty()) {
            //     return __('Please specify the quantity of product(s).')->render();
            // }
            
            $productsInfo[$subProduct->getId()] = $subProduct->isSalable() ? (float)$subProduct->getQty() : 0;
        }
    }

    return $productsInfo;
}

`

@larsroettig
Copy link
Member

larsroettig commented May 13, 2019

@joekersh preference is not the best way to solve this issue patching is a better way yesterday @mallikaverma creating a pr this look backwards compatible.

@dmytro-ch dmytro-ch self-assigned this May 27, 2019
@m2-assistant
Copy link

m2-assistant bot commented May 27, 2019

Hi @dmytro-ch. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • 6. Add label Issue: Confirmed once verification is complete.

  • 7. Make sure that automatic system confirms that report has been added to the backlog.

@dmytro-ch dmytro-ch added Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Component: GroupedProduct Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels May 27, 2019
@magento-engcom-team magento-engcom-team added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label May 27, 2019
@magento-engcom-team
Copy link
Contributor

✅ Confirmed by @dmytro-ch
Thank you for verifying the issue. Based on the provided information internal tickets MAGETWO-99841 were created

Issue Available: @dmytro-ch, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@reense
Copy link
Contributor

reense commented Jun 14, 2019

I can confirm that @larsroettig 's solution is working. Thanks !

@VladimirZaets
Copy link
Contributor

Hi @hamplr. Thank you for your report.
The issue has been fixed in #24955 by @gihovani in 2.4-develop branch
Related commit(s):

The fix will be available with the upcoming 2.4.0 release.

@VladimirZaets VladimirZaets added the Fixed in 2.4.x The issue has been fixed in 2.4-develop branch label Jan 17, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: GroupedProduct Event: imagine2019 Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests