Skip to content

Commit c133809

Browse files
committed
Merge pull request #55 from Smile-SA/release_1.3
Fix categories that were not indexed properly
2 parents 138e073 + 76eb37b commit c133809

File tree

1 file changed

+14
-12
lines changed
  • src/app/code/community/Smile/ElasticSearch/Model/Resource/Engine/Elasticsearch/Mapping/Catalog/Eav

1 file changed

+14
-12
lines changed

src/app/code/community/Smile/ElasticSearch/Model/Resource/Engine/Elasticsearch/Mapping/Catalog/Eav/Abstract.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -365,19 +365,21 @@ protected function _getAttributesById()
365365
$attributes = Mage::getResourceModel($this->_attributeCollectionModel)
366366
->setEntityTypeFilter($entityType->getEntityTypeId());
367367

368-
$conditions = array(
369-
'additional_table.is_searchable = 1',
370-
'additional_table.is_visible_in_advanced_search = 1',
371-
'additional_table.is_filterable > 0',
372-
'additional_table.is_filterable_in_search = 1',
373-
'additional_table.used_for_sort_by = 1',
374-
'additional_table.is_used_for_promo_rules',
375-
$this->getConnection()->quoteInto('main_table.attribute_code = ?', 'status'),
376-
$this->getConnection()->quoteInto('main_table.attribute_code = ?', 'visibility'),
377-
);
378-
379-
$attributes->getSelect()->where(sprintf('(%s)', implode(' OR ', $conditions)));
368+
if (method_exists($attributes, 'addToIndexFilter')) {
369+
$conditions = array(
370+
'additional_table.is_searchable = 1',
371+
'additional_table.is_visible_in_advanced_search = 1',
372+
'additional_table.is_filterable > 0',
373+
'additional_table.is_filterable_in_search = 1',
374+
'additional_table.used_for_sort_by = 1',
375+
'additional_table.is_used_for_promo_rules',
376+
$this->getConnection()->quoteInto('main_table.attribute_code = ?', 'status'),
377+
$this->getConnection()->quoteInto('main_table.attribute_code = ?', 'visibility'),
378+
);
380379

380+
$attributes->getSelect()->where(sprintf('(%s)', implode(' OR ', $conditions)));
381+
}
382+
381383
$this->_attributesById = array();
382384

383385
foreach ($attributes as $attribute) {

0 commit comments

Comments
 (0)