#12717 - Catalog Products List widget is not displayed on Storefront #12765
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Problem is that when flats are enabled, logic does not check if an attribute is actually present in flat table. Added a check that the attribute is in flat and if not, we join this attribute.
Fixed Issues (if relevant)
Manual testing scenarios
Go to Stores > Attributes > Product and open "Color" attribute
Create 2 options red and black
Add this attribute to attribute set
Create 2 simple products with red and black attributes
Go to Stores> Configuration > CATALOG > Catalog > Storefront
Set "Use Flat Catalog Category" = Yes and "Use Flat Catalog Product" = "Yes"
Go to Content > Widgets and create new widget with:
Storefront Properties
Widget Title = Test widget
Assign to Store Views = All Store Views
Layout Updates:
-- Display on = All Pages
-- Container = Main Content Area
Widget Options
Title = test
Number of Products to Display = 10
Conditions: Color is red
run
rm -rf var/* pub/static/* generated/*
php bin/magento indexer:reindex
php bin/magento setup:static-content:deploy
Go to Storefront
Expected result
Widget is visible on Storefront
Actual result
Widget is not visible on Storefront, following error persists in support_report.log:
report.CRITICAL: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'at_color.value' in 'where clause', query was: SELECT COUNT(DISTINCT e.entity_id) FROM catalog_product_flat_1 AS e
INNER JOIN catalog_category_product_index AS cat_index ON cat_index.product_id=e.entity_id AND cat_index.store_id='1' AND cat_index.visibility IN(2, 4) AND cat_index.category_id='2'
INNER JOIN catalog_product_index_price AS price_index ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0 WHERE (((IFNULL(at_color.value, 0) = '13') ))
Contribution checklist