Each of your custom attributes needs a source model with the following methods defined:
getFlatColums(): creates the value column on the flat tables
getFlatUpdateSelect(): populates the values
You can also specify an index for this column by defining getFlatIndexes().
For reference see Mage_Eav_Model_Entity_Attribute_Source_Boolean:
/**
* Retrieve flat column definition
*
* @return array
*/
public function getFlatColums()
{
$attributeCode = $this->getAttribute()->getAttributeCode();
$column = array(
'unsigned' => false,
'default' => null,
'extra' => null
);
if (Mage::helper('core')->useDbCompatibleMode()) {
$column['type'] = 'tinyint(1)';
$column['is_null'] = true;
} else {
$column['type'] = Varien_Db_Ddl_Table::TYPE_SMALLINT;
$column['length'] = 1;
$column['nullable'] = true;
$column['comment'] = $attributeCode . ' column';
}
return array($attributeCode => $column);
}
/**
* Retrieve Indexes(s) for Flat
*
* @return array
*/
public function getFlatIndexes()
{
$indexes = array();
$index = 'IDX_' . strtoupper($this->getAttribute()->getAttributeCode());
$indexes[$index] = array(
'type' => 'index',
'fields' => array($this->getAttribute()->getAttributeCode())
);
return $indexes;
}
/**
* Retrieve Select For Flat Attribute update
*
* @param int $store
* @return Varien_Db_Select|null
*/
public function getFlatUpdateSelect($store)
{
return Mage::getResourceModel('eav/entity_attribute')
->getFlatUpdateSelect($this->getAttribute(), $store);
}
/**
* Get a text for index option value
*
* @param string|int $value
* @return string|bool
*/
public function getIndexOptionText($value)
{
switch ($value) {
case self::VALUE_YES:
return 'Yes';
case self::VALUE_NO:
return 'No';
}
return parent::getIndexOptionText($value);
}