Skip to content

Commit 8ffcaa7

Browse files
committed
Merge remote-tracking branch 'github-magento2ce/MAGETWO-91750' into EPAM-PR-18
2 parents 76c77a2 + e18bcb5 commit 8ffcaa7

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -570,8 +570,8 @@ public function prepareProductIndex($indexData, $productData, $storeId)
570570
}
571571
}
572572
foreach ($indexData as $entityId => $attributeData) {
573-
foreach ($attributeData as $attributeId => $attributeValue) {
574-
$value = $this->getAttributeValue($attributeId, $attributeValue, $storeId);
573+
foreach ($attributeData as $attributeId => $attributeValues) {
574+
$value = $this->getAttributeValue($attributeId, $attributeValues, $storeId);
575575
if (!empty($value)) {
576576
if (isset($index[$attributeId])) {
577577
$index[$attributeId][$entityId] = $value;
@@ -602,16 +602,16 @@ public function prepareProductIndex($indexData, $productData, $storeId)
602602
* Retrieve attribute source value for search
603603
*
604604
* @param int $attributeId
605-
* @param mixed $valueId
605+
* @param mixed $valueIds
606606
* @param int $storeId
607607
* @return string
608608
*/
609-
private function getAttributeValue($attributeId, $valueId, $storeId)
609+
private function getAttributeValue($attributeId, $valueIds, $storeId)
610610
{
611611
$attribute = $this->getSearchableAttribute($attributeId);
612-
$value = $this->engine->processAttributeValue($attribute, $valueId);
612+
$value = $this->engine->processAttributeValue($attribute, $valueIds);
613613
if (false !== $value) {
614-
$optionValue = $this->getAttributeOptionValue($attributeId, $valueId, $storeId);
614+
$optionValue = $this->getAttributeOptionValue($attributeId, $valueIds, $storeId);
615615
if (null === $optionValue) {
616616
$value = $this->filterAttributeValue($value);
617617
} else {
@@ -626,13 +626,15 @@ private function getAttributeValue($attributeId, $valueId, $storeId)
626626
* Get attribute option value
627627
*
628628
* @param int $attributeId
629-
* @param int $valueId
629+
* @param int|string $valueIds
630630
* @param int $storeId
631631
* @return null|string
632632
*/
633-
private function getAttributeOptionValue($attributeId, $valueId, $storeId)
633+
private function getAttributeOptionValue($attributeId, $valueIds, $storeId)
634634
{
635635
$optionKey = $attributeId . '-' . $storeId;
636+
$attributeValueIds = explode(',', $valueIds);
637+
$attributeOptionValue = '';
636638
if (!array_key_exists($optionKey, $this->attributeOptions)
637639
) {
638640
$attribute = $this->getSearchableAttribute($attributeId);
@@ -650,8 +652,12 @@ private function getAttributeOptionValue($attributeId, $valueId, $storeId)
650652
$this->attributeOptions[$optionKey] = null;
651653
}
652654
}
653-
654-
return $this->attributeOptions[$optionKey][$valueId] ?? null;
655+
foreach ($attributeValueIds as $attrValueId) {
656+
if (isset($this->attributeOptions[$optionKey][$attrValueId])) {
657+
$attributeOptionValue .= $this->attributeOptions[$optionKey][$attrValueId] . ' ';
658+
}
659+
}
660+
return empty($attributeOptionValue) ? null : trim($attributeOptionValue);
655661
}
656662

657663
/**

0 commit comments

Comments
 (0)