-
Notifications
You must be signed in to change notification settings - Fork 351
Filter only InStock child products in the products index. #3631
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
base: 2.11.x
Are you sure you want to change the base?
Filter only InStock child products in the products index. #3631
Conversation
|
This should cover all cases, but if I’ve overlooked anything, please let me know. Btw, I’m uncertain how to properly address the PHPMD test. |
|
Hot fix: just to add Long story: The class has a coupling value of 14, exceeding the recommended limit of 13, making it harder to understand, maintain, and test. Therefore, it's need to refactor the class to reduce the number of dependencies on other classes. |
| /** | ||
| * If Catalog - Inventory - Stock Options - Display of Stock Products is set to NO, | ||
| * then exclude this children from the query results. | ||
| */ | ||
| if (!$this->scopeConfig->getValue(Configuration::XML_PATH_SHOW_OUT_OF_STOCK)) { | ||
| $select->joinInner( | ||
| ['stock' => $inventoryTable], | ||
| new \Zend_Db_Expr("child.{$entityIdField} = stock.product_id AND stock.is_in_stock = 1"), | ||
| [] | ||
| ); | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @Bashev,
Wouldn't this piece of code only do what it is intended to do if
- not using MSI
- using MSI but the current storeId corresponds to a store using the default Stock ?
Regards,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably,
to be honest, i not test it with MSI which have multiple sources and stocks.
I'll try to check these scenarios and will come back.
Fix #3630