cancel
Showing results for 
Search instead for 
Did you mean: 

Blocks missing after enabling flat tables

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Blocks missing after enabling flat tables

Hello, 

I have a home page with a series of blocks that contain widgets for filtering and displaying products. They were working as expected until I took the following steps: 

- Enabled flat categories and products
- Merged and minified CSS and Java

We could not fix the problem, but we did find the following: 

==> var/log/system.log <==
[2016-11-05 15:43:54] main.CRITICAL: Broken reference: No element found with ID 'main'. [] []
[2016-11-05 15:43:54] main.CRITICAL: Broken reference: No element found with ID 'main'. [] []
[2016-11-05 15:43:54] main.CRITICAL: Broken reference: No element found with ID 'main'. [] []
[2016-11-05 15:43:54] main.CRITICAL: Broken reference: No element found with ID 'main'. [] []
[2016-11-05 15:43:54] main.CRITICAL: Broken reference: No element found with ID 'main'. [] []
[2016-11-05 15:43:54] main.CRITICAL: Broken reference: No element found with ID 'main'. [] []
[2016-11-05 15:43:54] main.CRITICAL: Broken reference: No element found with ID 'main'. [] []
[2016-11-05 15:43:54] main.CRITICAL: Broken reference: No element found with ID 'main'. [] []

and

Reviewing the exception log, this appears to relate to the /vendor/magento/module-cms/Block/Widget/Block.php

Next Zend_Db_Statement_Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'e.color' 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
INNER JOIN `cataloginventory_stock_status` AS `stock_status_index` ON e.entity_id = stock_status_index.product_id AND stock_status_index.website_id = 0 AND stock_status_index.stock_id = 1 WHERE (((IFNULL(`e`.`color`, 0) = '368') )) AND (stock_status_index.stock_status = 1) in /chroot/home/thegames/thegamestork.com/html/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:235
Stack trace:


There were two blocks that were not working as expected. In one, I fixed the problem because I realized that only attributed marked as visible on the front end get added to the flat table. 

But the other missing block keeps producing the following (on the frontend): 

We're sorry, an error has occurred while generating this email.


I have no idea why this is happening.