In app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Flat/Indexer.php (Magento 1.5) or in app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php in later versions I believe:
The public function getAttributesCodes()
retrieves the attribute codes that will go into the flat table. Here is the WHERE condition:
$whereCond = array(
$this->_getReadAdapter()->quoteInto('main_table.backend_type=?', 'static'),
$this->_getReadAdapter()->quoteInto('additional_table.used_in_product_listing=?', 1),
$this->_getReadAdapter()->quoteInto('additional_table.used_for_sort_by=?', 1),
$this->_getReadAdapter()->quoteInto('main_table.attribute_code IN(?)', $this->_systemAttributes)
);
if ($this->getFlatHelper()->isAddFilterableAttributes()) {
$whereCond[] = $this->_getReadAdapter()->quoteInto('additional_table.is_filterable>?', 0);
}
Clearly, certain attribute types are always added to the table. Static
, used_in_product_listing=1
, used_for_sort_by=1
, and the attributes listed in $this->_systemAttributes
(status
, required_options
, tax_class_id
, weight
).
The `if statement is where I'm stuck. Are filterable attributes added or not? How to determine if they are or not?
I found this file: app/code/core/Mage/Catalog/Helper/Product/Flat.php
It has a class constant: const XML_NODE_ADD_FILTERABLE_ATTRIBUTES = 'global/catalog/product/flat/add_filterable_attributes';
It's used in this function:
public function isAddFilterableAttributes()
{
return intval(Mage::getConfig()->getNode(self::XML_NODE_ADD_FILTERABLE_ATTRIBUTES));
}
What does it all mean? How do I know if filterable attributes will be added? What determines it? What changes it?