Magento 2 Empty Category Page: Fixing NULL in the Collection WHERE Condition

Magento 2 Empty Category Page: Fixing NULL in the Collection WHERE Condition

Magento 2 category or search page empty? Check third-party modules, Elasticsearch and attribute backend_type first — with the SQL to diagnose it.

Few things you should try out first

  • Disable the third-party modules.
  • Make sure elasticsearch is up and running
  • Run the below query to see if is there any issue with backend_type in attributes

If still doesn’t work and Check below in database

SELECT *
FROM catalog_eav_attribute cea 
JOIN eav_attribute ea
ON ea.attribute_id = cea.attribute_id 
AND backend_type IN ('text')
WHERE 
cea.is_filterable = 1 OR cea.is_filterable_in_search = 1

And if you find any attribute mis configured run below sql

UPDATE catalog_eav_attribute cea 
JOIN eav_attribute ea
ON ea.attribute_id = cea.attribute_id 
AND backend_type in ('text')
SET 
cea.is_filterable = 0, cea.is_filterable_in_search = 0
WHERE 
cea.is_filterable = 1 OR cea.is_filterable_in_search = 1

And to update on magento do reindexing

magento indexer:reindex
magento cache:clean
magento cache:flush

 

Further reading: Adobe Commerce PHP developer guide. Need a hand? Our Magento development team can help.

Need a hand?

Stuck on a build?
Let's solve it together.

Our engineers fix, upgrade and scale Magento, WordPress and modern stacks every day.