Improved ProductFlat listener to make fillable attribute codes overridable

This commit is contained in:
Poghos 2021-04-26 13:27:30 +04:00
parent e024a876b0
commit e5f1b33f48
1 changed files with 14 additions and 1 deletions

View File

@ -48,6 +48,19 @@ class ProductFlat
*/
protected $attribute;
/**
* Attribute codes that can be fill during flat creation.
*
* @var string[]
*/
protected $fillableAttributeCodes = [
'sku',
'name',
'price',
'weight',
'status'
];
/**
* @var array
*/
@ -212,7 +225,7 @@ class ProductFlat
}
foreach ($familyAttributes[$product->attribute_family->id] as $attribute) {
if ($parentProduct && ! in_array($attribute->code, array_merge($superAttributes[$parentProduct->id], ['sku', 'name', 'price', 'weight', 'status']))) {
if ($parentProduct && ! in_array($attribute->code, array_merge($superAttributes[$parentProduct->id], $this->fillableAttributeCodes))) {
continue;
}