Magento – Use Flat Catalog Category disable

flat

Use Flat Catalog Category in Catalog is disable or Hide, Why?
enter image description here

Best Answer

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.

Related Topic