Fixes on available offers in category childrens for building menu

This commit is contained in:
Ludovic CANDELLIER
2022-04-25 22:36:43 +02:00
parent c9bf18d87d
commit 61a52ef330
3 changed files with 5 additions and 8 deletions

View File

@@ -36,11 +36,6 @@ class Category extends parentCategory
return $this->morphedByMany(Article::class, 'categorizable');
}
public function ArticlesByParent()
{
}
public function ArticlesTagged()
{
return $this->tags->articles;
@@ -94,6 +89,8 @@ class Category extends parentCategory
$sale_channel_id = $sale_channel_id ? $sale_channel_id : SaleChannels::getDefaultID();
return $query->whereHas('articles', function ($query) use ($sale_channel_id) {
$query->WithAvailableOffers($sale_channel_id);
})->orWhereHas('descendants.articles', function ($query) use ($sale_channel_id) {
$query->WithAvailableOffers($sale_channel_id);
});
}
}