-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Setting 'show_out_of_stock' to 'No' has no effect #8566
Comments
|
Relates to issue: magento#8566 A flag set to null will always overwrite the isShowOutOfStock variable. So you can't set the default value from the admin configuration.
I can verify this is still a problem, it should properly just change && to ||. I created a PR that seems to fix this for me: #8736 |
I don't think the value should be changed to an 'or' because the flag that's being referenced does not exist in the CE edition. Like @orlangur said, it would be better to replace the flag value with true or just remove it all together ? The fix we are currently using which works, is:
|
@koenner01 No but I think the flag is valuable in some use cases, where you would want to limit what your collection contains to products in store, and this is then an easy way. |
But is it not weird and confusing to leave a flag in the code that isn't referenced anywhere in the entire CE ? |
No I don't think so. Their are lots of things in CE not used anywhere the easiest thing I could think of would be lots of the events fired in Magento (I know this isn't an event). Also if EE or ECE base code starts being different from the CE project it will be super confusing for extension providers / SI's. |
Doesn't it make more sense then that we should set the flag value to true if its value is non existent ? |
@koenner01, dunno what's the reasoning behind PR acceptance (just a quick-fix as a temporary solution?). I believe c966dc1 is simply wrong from modularity perspective and should be done as plugin/interceptor or any other way of extending CE behavior NOT residing in CE repository but in another one where all operations with this flag occur. |
I think @koenner01 is true : If the flag is NULL then it means that it has not been set before. Then I think the best way is to add a default value to true. |
Hello, PHP Fatal error: Uncaught Error: Call to a member function getPrice() on null in ../vendor/magento/module-configurable-product/Model/Product/Type/Configurable/Price.php:43\nStack trace:\n#0 ../vendor/magento/module-catalog/Model/Product.php(554) |
@koenner01 We cannot reproduce this issue as described. Please provide the detailed steps we must follow to reproduce this issue. In addition, identify the web server you are running, the versions of PHP and MySQL, and any other information needed to reproduce your issue. |
According to contributor guide, tickets without response for two weeks should be closed. |
Internal ticket to track issue progress: MAGETWO-65334 |
magento/magento2#8566 Applies to: - 2.1.3-2.1.11 - 2.0.*
magento/magento2#8566 Applies to: - 2.1.3-2.1.11 - 2.0.*
Setting the value of 'Display Out of Stock Products' in the backend to 'No' does not have the effect desired. If you set this to 'No' you would expect that only products that are in stock are shown.
Preconditions
Steps to reproduce
Expected result
Actual result
We traced this issue back to Magento\CatalogInventory\Helper\Stock.
In the function addIsInStockFilterToCollection a flag check is done on 'require_stock_items'. Because this flag is never set or used in Magento (wtf!), it causes the second parameter in addStockDataToCollection to always be false. This has the undesired effect that out of stock products are shown...
It is our opinion that the '&& $collection->getFlag('require_stock_items')' should be removed as it is never set or referenced in the entire Magento project. Removing this part also fixes the fact the out-of-stock products are shown
The text was updated successfully, but these errors were encountered: