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

Configurable products with first simple product 'out of stock' breaks catalog 2.1.1 #6799

Closed
staffrob opened this issue Sep 29, 2016 · 22 comments
Labels
bug report Component: Catalog Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed 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

Comments

@staffrob
Copy link

Preconditions

  1. Magento 2 CE 2.1.1, PHP7, MYSQL14.14

Steps to reproduce

  1. Fresh install 2.1.1
  2. add new configurable product with multiple simple products (ie color red,blue,yellow with qty's >0)
  3. Product is now displaying on frontend as expected
  4. Now go back to admin and mark first (lowest product id) simple product as 'out of stock'.

Expected result

  1. Display configurable product as normal on frontend

Actual result

  1. 1 exception(s):
    Exception #0 (Magento\Framework\Exception\LocalizedException): Configurable product "BSBG" does not have sub-products

Exception #0 (Magento\Framework\Exception\LocalizedException): Configurable product "BSBG" does not have sub-products
#0 /home/72576-57509.cloudwaysapps.com/jpyshppark/public_html/vendor/magento/module-configurable-product/Pricing/Price/FinalPrice.php(43): Magento\ConfigurableProduct\Pricing\Price\ConfigurablePriceResolver->resolvePrice(Object(Magento\Catalog\Model\Product\Interceptor))

  1. Product not visible on frontend, any category pages this product appears on will not show other products either.
@miakusha
Copy link
Contributor

miakusha commented Sep 29, 2016

Hi @staffrob , thank for report
Internal ticket MAGETWO-58922, is in our issue backlog.

@miakusha miakusha added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report Component: Catalog 2.1.x labels Sep 29, 2016
@heldchen
Copy link
Contributor

heldchen commented Sep 29, 2016

probably a duplicate of #6422 and related to #6512

@nissablagojevic
Copy link

Did some debugging here in this related thread: #5762

@Ctucker9233
Copy link

@nissablagojevic saw your debug and would like to know where you found ->limit(1).

@ghost
Copy link

ghost commented Oct 17, 2016

In version 2.1.2 (after upgrade from 2.1.1 with same problems) the problem still exists.
The frontend catalog page can not display product where config product has one-or-more out-of-stock childproduct(s) (variation).
The var/system.log contains:
"main.Critical: Configurable product "[sku]" does not have sub-pruducts"

If i increase qty and set prodcut "in-stock" on the out-of-stock child, the frontend shows as expected.
If i set qty to zero and stock status: out-of stock, the error comes back.

I can reproduce this situation with 2 different magento installation.

@nmallepally
Copy link

Hi,
I have the same issue after upgrading to 2.1.2, the problem still persists.
Any work around fix? Tried cleaning browser cache as advised by magento team. no result.

It says
Erreur lors du traitement du gabarit: Configurable product "kit_pro" does not have sub-products
Gives me list of exceptions attached.
exceptionlist.txt

@immist
Copy link

immist commented Oct 19, 2016

@interpigeon @nmallepally: This pull request fixes the issue: #7030
The treatment of this issue by @magento-admin is a shame. Next time I will reconsider twice before recommending Magento to a client again.

@nmallepally
Copy link

@immist Thanks.. Great, worked absolutely fine after applying the fix.
Just brought life to my Magento site. Thanks a mil.
Yes, it's sad Magento is not addressing the critical issues, even with cron indexing as well.
now, I can safely upgrade on to my live site now.

@Elsa3dy
Copy link

Elsa3dy commented Dec 9, 2016

@nmallepally Please can you share with me what exactly you did?

@staffrob
Copy link
Author

I have just upgraded 2.1.2 to 2.1.3 and now price on configurable product page displays as $0 (zero) until an attribute is selected.

This only occurs if the first configurable attribute qty is 0 or out of stock.
If the first configurable attribute is in stock or >0 price on the cofigurable product page is as expected ie $79.95

@EmilyPepperman
Copy link
Contributor

Since upgrading to 2.1.3 we have this issue as well as stated by @staffrob

@dmandave
Copy link

dmandave commented Mar 15, 2017

We're having the same issue as staffrob- configurable products with out of stock individual products are showing a price of $0 on both the catalog landing pages and the individual product pages. Magento 2.1.4

@yumicom
Copy link

yumicom commented Apr 7, 2017

I have the same issue - price on configurable product displays as $0, if configurable attribute qty is 0 or out of stock. Magento 2.1.5

@Szymon-GP
Copy link

Magento 2.1.7 and I'm still having the same issue, price shows 0 if all the simple products are out of stock

@aramega
Copy link

aramega commented Aug 9, 2017

@Szymon-GP Yes me too. Magento 2.1.6

@erfanimani
Copy link
Contributor

erfanimani commented Aug 13, 2017

Still the same on 2.1.8 :/ ($0 product)

@mattdillon100
Copy link

Found the solution!

The problem appears to be that, in the price resolver (\Magento\ConfigurableProduct\Pricing\Price\ConfigurablePriceResolver), the resolvePrice method loops through the simple products of the configurable looking for a price for an available item. When all items are out of stock, there is no price to return.
I fixed this by adding the line:

$price = $price ? $price : $product->getData('price');

after the foreach loop. This will get the configurable product price.

All that is required is to override this class in your own module and add the line above.

@erfanimani
Copy link
Contributor

@wildcard27 that doesn't seem to work with multi-currency..

@mattdillon100
Copy link

@erfanimani Seems to be working on my project with multi currency. Do you have any errors is it just failing?

@erfanimani
Copy link
Contributor

@wildcard27 , actually - my bad. It's not working for product listings created through widget instances. Rest of the time it works fine with multi-currency. Probably a cache issue.

Thanks for sharing your solution!

@magento-engcom-team magento-engcom-team added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report Component: Catalog Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed labels Sep 11, 2017
@magento-engcom-team magento-engcom-team added the Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed label Sep 20, 2017
@magento-engcom-team
Copy link
Contributor

Hello @staffrob. Your issue has been fixed in later versions. If You are still able to reproduce it on 2.1.9 please let us know.

@magento-engcom-team
Copy link
Contributor

@staffrob, thank you for your report.
We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue.

@magento-engcom-team magento-engcom-team added the Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch label Sep 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Catalog Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed 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
Projects
None yet
Development

No branches or pull requests