Use Flat Catalog Category in Catalog is disable or Hide, Why?
3 Answers
The flat category config field has a frontend model adminhtml/system_config_form_field_select_flatcatalog
. Look for it in app/code/core/Mage/Catalog/etc/system.xml
.
The frontend model is actually a block that renders the field.
This block is Mage_Adminhtml_Block_System_Config_Form_Field_Select_Flatcatalog
. If you take a look at it, you will see this method:
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
if (!Mage::helper('catalog/category_flat')->isBuilt()) {
$element->setDisabled(true)
->setValue(0);
}
return parent::_getElementHtml($element);
}
$this means that the element is disabled if Mage_Catalog_Helper_Category_Flat::isBuilt()
return false
.
Digging deeper you end up in the method Mage_Catalog_Model_Resource_Category_Flat::isBuilt()
that returns false if there is no flat table for any store view or if the flat tables don't have entities.
Reindexing should fix everything.
-
How to bypass disabled products from reindexing magento 2 [EE] Oct 5, 2020 at 12:04
It's probably disabled because catalog_category_flat_store_x table is empty. Go to System > Index Management and reindex Category Products option and see if that enables the option.
This option will always be disabled if no products are in the store (so by default, it will be disabled until you add a product & reindex)