/** * Prepare Fulltext index value for product * * @param array $indexData * @param array $productData * @param int $storeId * @return string */ protected function _prepareProductIndex($indexData, $productData, $storeId) { if (!Mage::getStoreConfigFlag('sphinxsearch/active/indexer')) { return parent::_prepareProductIndex($indexData, $productData, $storeId); } $index = array(); foreach ($this->_getSearchableAttributes('static') as $attribute) { $attributeCode = $attribute->getAttributeCode(); if (isset($productData[$attributeCode])) { $value = $this->_getAttributeValue($attribute->getId(), $productData[$attributeCode], $storeId); if ($value) { //For grouped products if (isset($index[$attributeCode])) { if (!is_array($index[$attributeCode])) { $index[$attributeCode] = array($index[$attributeCode]); } $index[$attributeCode][] = $value; } else { $index[$attributeCode] = $value; } } } } foreach ($indexData as $entityId => $attributeData) { foreach ($attributeData as $attributeId => $attributeValue) { $value = $this->_getAttributeValue($attributeId, $attributeValue, $storeId); if (!is_null($value) && $value !== false) { $attributeCode = $this->_getSearchableAttribute($attributeId)->getAttributeCode(); if (isset($index[$attributeCode])) { $index[$attributeCode][$entityId] = $value; } else { $index[$attributeCode] = array($entityId => $value); } } } } if (!$this->_engine->allowAdvancedIndex()) { $product = $this->_getProductEmulator()->setId($productData['entity_id'])->setTypeId($productData['type_id'])->setStoreId($storeId); $typeInstance = $this->_getProductTypeInstance($productData['type_id']); if ($data = $typeInstance->getSearchableData($product)) { $index['options'] = $data; } } if (isset($productData['in_stock'])) { $index['in_stock'] = $productData['in_stock']; } return $this->_engine->prepareEntityIndex($index, $this->_separator, $productData['entity_id']); }