diff --git a/src/Casts/QuoteItems.php b/src/Casts/QuoteItems.php index 30c5f7b82..72a34c2d0 100644 --- a/src/Casts/QuoteItems.php +++ b/src/Casts/QuoteItems.php @@ -14,7 +14,7 @@ public function get($model, $key, $value, $attributes) // which joins the catalog_product_super_attribute_label table. $attributeModel = config('rapidez.models.attribute'); $superAttributes = Arr::pluck($attributeModel::getCachedWhere(function ($attribute) { - return $attribute['super']; + return $attribute['super'] && $attribute['flat']; }), 'name', 'id'); $items = json_decode($value); diff --git a/src/Listeners/MagentoSettingsHealthcheck.php b/src/Listeners/MagentoSettingsHealthcheck.php index 56b89a530..0a1f38623 100644 --- a/src/Listeners/MagentoSettingsHealthcheck.php +++ b/src/Listeners/MagentoSettingsHealthcheck.php @@ -54,7 +54,7 @@ public function handle() ]; } - $superAttributesCount = count($attributeModel::getCachedWhere(fn ($attribute) => $attribute['super'])); + $superAttributesCount = count($attributeModel::getCachedWhere(fn ($attribute) => $attribute['super'] && $attribute['flat'])); $joinCount = ($superAttributesCount * 2) + (count($nonFlatAttributes) * 3) + 4; if ($joinCount > 58) { diff --git a/src/Models/Scopes/Product/WithProductChildrenScope.php b/src/Models/Scopes/Product/WithProductChildrenScope.php index 840012074..ea9fc7759 100644 --- a/src/Models/Scopes/Product/WithProductChildrenScope.php +++ b/src/Models/Scopes/Product/WithProductChildrenScope.php @@ -16,7 +16,7 @@ public function apply(Builder $builder, Model $model) $attributeModel = config('rapidez.models.attribute'); $superAttributes = Arr::pluck($attributeModel::getCachedWhere(function ($attribute) { - return $attribute['super']; + return $attribute['super'] && $attribute['flat']; }), 'code'); $grammar = $builder->getQuery()->getGrammar(); diff --git a/src/Models/Scopes/Product/WithProductSuperAttributesScope.php b/src/Models/Scopes/Product/WithProductSuperAttributesScope.php index 13ecbc546..b81afb5bc 100644 --- a/src/Models/Scopes/Product/WithProductSuperAttributesScope.php +++ b/src/Models/Scopes/Product/WithProductSuperAttributesScope.php @@ -14,7 +14,7 @@ public function apply(Builder $builder, Model $model) { $attributeModel = config('rapidez.models.attribute'); $superAttributes = Arr::pluck($attributeModel::getCachedWhere(function ($attribute) { - return $attribute['super']; + return $attribute['super'] && $attribute['flat']; }), 'code', 'id'); $grammar = $builder->getQuery()->getGrammar(); diff --git a/src/Models/Traits/Product/CastSuperAttributes.php b/src/Models/Traits/Product/CastSuperAttributes.php index 58c95fde8..e3c2faaf4 100644 --- a/src/Models/Traits/Product/CastSuperAttributes.php +++ b/src/Models/Traits/Product/CastSuperAttributes.php @@ -10,7 +10,7 @@ protected function getSuperAttributeCasts(): array { $attributeModel = config('rapidez.models.attribute'); $superAttributes = Arr::pluck($attributeModel::getCachedWhere(function ($attribute) { - return $attribute['super']; + return $attribute['super'] && $attribute['flat']; }), 'code'); foreach ($superAttributes as $superAttribute) {