diff --git a/packages/Webkul/Product/src/Listeners/ProductFlat.php b/packages/Webkul/Product/src/Listeners/ProductFlat.php index cba08a127..16b219840 100644 --- a/packages/Webkul/Product/src/Listeners/ProductFlat.php +++ b/packages/Webkul/Product/src/Listeners/ProductFlat.php @@ -184,8 +184,8 @@ class ProductFlat if (in_array($attribute->code, ['short_description', 'tax_category_id', 'meta_title', 'meta_keywords', 'meta_description', 'width', 'height'])) continue; - // if (! Schema::hasColumn('product_flat', $attribute->code)) - // continue; + if (! Schema::hasColumn('product_flat', $attribute->code)) + continue; if ($attribute->value_per_channel) { if ($attribute->value_per_locale) { @@ -217,6 +217,24 @@ class ProductFlat $productFlat->{$attribute->code . '_label'} = $attributeOption->admin_name; } } + } elseif ($attribute->type == 'multiselect') { + $attributeOptionIds = explode(',', $product->{$attribute->code}); + + if (count($attributeOptionIds)) { + $attributeOptions = $this->attributeOptionRepository->findWhereIn('id', $attributeOptionIds); + + $optionLabels = []; + + foreach ($attributeOptions as $attributeOption) { + if ($attributeOptionTranslation = $attributeOption->translate($locale->code)) { + $optionLabels[] = $attributeOptionTranslation->label; + } else { + $optionLabels[] = $attributeOption->admin_name; + } + } + + $productFlat->{$attribute->code . '_label'} = implode(', ', $optionLabels); + } } }