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

Bug/fix error on out of stock configurable product #764

Conversation

chapagain
Copy link
Contributor

This error was logged while browsing out-of-stock configurable products that have zero configurations (associated simple products).

Description

Error:

Noticed exception 'Nosto\Exception\NonBuildableProductException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')))) AND (stock_status_index.stock_status = 1)) AND (e.created_in <= '1644307...' at line 3, query was: SELECT e.*, stock_status_index.stock_status AS is_salable FROM catalog_product_entity AS e INNER JOIN catalog_product_website AS product_website ON product_website.product_id = e.entity_id AND product_website.website_id IN(3) INNER JOIN cataloginventory_stock_status AS stock_status_index ON e.entity_id = stock_status_index.product_id WHERE ((((e.entity_id = 'in') OR (()))) AND (stock_status_index.stock_status = 1)) AND (e.created_in <= '1644307200') AND (e.updated_in > '1644307200')' in vendor/nosto/module-nostotagging/Model/Product/Builder.php:312

In Model/Product/Repository.php:

getSkuIds function calls for associated products of the configurable product:

$this->configurableType->getChildrenIds($product->getId());

If getSkuIds returns empty array then stockProvider->getInStockProductIds() will be querying for empty list.

How Has This Been Tested?

  1. Switch to developer mode.
bin/magento deploy:mode:set developer
  1. Add a configurable product with no/zero configurations (associated simple products).
    OR, remove all the configurable from an existing configurable product.

  2. Clear Cache.

bin/magento cache:flush
  1. Open the configurable product link in the browser

  2. Check the debug log (var/log/debug.log). The error mentioned above is logged in the debug.log file.

@dairbuirabass dairbuirabass self-assigned this Mar 24, 2022
@supercid supercid merged commit 324cf2e into Nosto:develop Mar 24, 2022
@supercid
Copy link
Member

Hi @chapagain Thanks for your contribution. Sorry it took long to review and merge, but this is now on our roadmap to be released soon! 🎉

@chapagain
Copy link
Contributor Author

Thank you @supercid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants