Add prices and filtering by sale_channel with default
This commit is contained in:
@@ -27,15 +27,14 @@ class Articles
|
||||
return $export;
|
||||
}
|
||||
|
||||
public static function getOffersGroupedByNature($id)
|
||||
public static function getOffersGroupedByNature($id, $sale_channel_id = false)
|
||||
{
|
||||
$article_ids = self::getSiblingsIds($id);
|
||||
$offers = Offers::getOffersByArticles($article_ids);
|
||||
// dump($offers->toArray());
|
||||
$offers = Offers::getOffersByArticles($article_ids, $sale_channel_id);
|
||||
foreach ($offers as $offer) {
|
||||
$data[$offer->article_nature->name][] = [
|
||||
$data[strtolower($offer->article_nature->name)] = [
|
||||
'name' => $offer->variation->name,
|
||||
'tariff' => $offer->tariff,
|
||||
'prices' => $offer->tariff->price_lists->first()->price_list_values->toArray(),
|
||||
];
|
||||
}
|
||||
return $data;
|
||||
@@ -86,7 +85,7 @@ class Articles
|
||||
$data['inherited'] = self::getInherited($id);
|
||||
$data['categories'] = self::getCategoriesNameByArticle($article);
|
||||
$data['tags'] = self::getTagsSlugByArticle($article);
|
||||
$data['offers'] = self::getOffersById($id)->toArray();
|
||||
$data['offers'] = self::getOffersGroupedByNature($id);
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user