1

I have created several attributes and want now to filter on them.

I create the attributes with these values:

$defaults = [
    'required' => false,
    'comparable' => true,
    'filterable' => true,
    'filterable_in_search' => true,
    'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
    'is_configurable' => false,
    'is_html_allowed_on_front' => true,
    'searchable' => true,
    'unique' => false,
    'used_for_sort_by' => true,
    'used_in_product_listing' => true,
    'user_defined' => true,
    'visible' => true,
    'visible_on_front' => true,
    'visible_in_advanced_search' => true,
];

and also specify the respective attribute with this:

'cut' => [
        'type' => 'varchar',
        'input' => 'select',
        'label' => 'Cut',
        'group' => MyCustom_Catalog_Helper_Data::EAV_ATTRIBUTE_GROUP_NAME,
        'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
        'source' => 'mycustom_catalog/product_attribute_source_cut'
    ]

Both arrays are getting merged correctly while creating the attributes.

In the source model, I have declared getFlatColumns() and getFlatUpdateSelect() like this:

public function getFlatColums()
{
    $attributeCode = $this->getAttribute()->getAttributeCode();
    $column        = [
        'unsigned' => false,
        'default'  => null,
        'extra'    => null,
    ];

    if (Mage::helper('core')->useDbCompatibleMode()) {
        $column['type']    = 'varchar';
        $column['is_null'] = true;
    } else {
        $column['type']     = Varien_Db_Ddl_Table::TYPE_VARCHAR;
        $column['nullable'] = true;
        $column['comment']  = '';
    }

    return [$attributeCode => $column];
}

public function getFlatUpdateSelect($store)
{
    return Mage::getResourceSingleton('eav/entity_attribute')
        ->getFlatUpdateSelect($this->getAttribute(), $store);
}

If I edit my products now and set the filter for cut, I can see the data being in the Flat Table, however the Value does not appear in catalog_product_index_eav.

I have re indexed all indexers after every new try and also cleared the cache.

Objective: I want to have the Attribute being filterable and visible in the Filter Layered Navigation.

What am I doing wrong?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.