Now variant's super attributes values are saving in product_flat table

This commit is contained in:
jitendra 2019-04-26 12:43:42 +05:30
parent c4c55bc48d
commit 10e92dada3
1 changed files with 6 additions and 1 deletions

View File

@ -158,9 +158,14 @@ class ProductFlat
{
static $familyAttributes = [];
static $superAttributes = [];
if (! array_key_exists($product->attribute_family->id, $familyAttributes))
$familyAttributes[$product->attribute_family->id] = $product->attribute_family->custom_attributes;
if ($parentProduct && ! array_key_exists($parentProduct->id, $superAttributes))
$superAttributes[$parentProduct->id] = $parentProduct->super_attributes()->pluck('code')->toArray();
foreach (core()->getAllChannels() as $channel) {
foreach ($channel->locales as $locale) {
$productFlat = $this->productFlatRepository->findOneWhere([
@ -178,7 +183,7 @@ class ProductFlat
}
foreach ($familyAttributes[$product->attribute_family->id] as $attribute) {
if ($parentProduct && ! in_array($attribute->code, ['sku', 'name', 'price', 'weight', 'status']))
if ($parentProduct && ! in_array($attribute->code, array_merge($superAttributes[$parentProduct->id], ['sku', 'name', 'price', 'weight', 'status'])))
continue;
if (in_array($attribute->code, ['short_description', 'tax_category_id', 'meta_title', 'meta_keywords', 'meta_description', 'width', 'height']))