/** * Retrieve attribute source value for search * * @param int $attributeId * @param mixed $valueId * @param int $storeId * @return mixed */ protected function getAttributeValue($attributeId, $valueId, $storeId) { $attribute = $this->getSearchableAttribute($attributeId); $value = $this->engine->processAttributeValue($attribute, $valueId); if ($attribute->getIsSearchable() && $attribute->usesSource() && $this->engine->allowAdvancedIndex()) { $attribute->setStoreId($storeId); $valueText = $attribute->getSource()->getIndexOptionText($valueId); if (is_array($valueText)) { $value .= $this->separator . implode($this->separator, $valueText); } else { $value .= $this->separator . $valueText; } } $value = preg_replace('/\\s+/siu', ' ', trim(strip_tags($value))); return $value; }