Add new data in getBasket context
This commit is contained in:
@@ -43,8 +43,9 @@ class Offers
|
||||
return $offer->price_lists->first()->price_list_values->first();
|
||||
}
|
||||
|
||||
public static function getBasket()
|
||||
public static function getBasket($sale_channel_id = false)
|
||||
{
|
||||
$sale_channel_id = $sale_channel_id ? $sale_channel_id : SaleChannels::getDefaultID();
|
||||
$basket = ShopCart::getContent();
|
||||
// dump($basket->toArray());
|
||||
$offers = Offer::with([
|
||||
@@ -52,11 +53,11 @@ class Offers
|
||||
'article.article_nature',
|
||||
'article.product.Specie',
|
||||
'article.image',
|
||||
])->whereIn('id', ShopCart::keys())->get();
|
||||
'price_lists.price_list_values',
|
||||
])->withPriceListsBySaleChannel($sale_channel_id)
|
||||
->whereIn('id', ShopCart::keys())->get();
|
||||
foreach ($basket as $item) {
|
||||
$offer = $offers->where('id', $item->id)->first();
|
||||
dump($offer->toArray());
|
||||
exit;
|
||||
$article_nature = strtolower($offer->article->article_nature->name);
|
||||
$data[$article_nature][] = [
|
||||
'id' => (int) $item->id,
|
||||
@@ -65,6 +66,7 @@ class Offers
|
||||
'price' => $item->price,
|
||||
'variation' => $offer->variation->name,
|
||||
'image' => Articles::getPreviewSrc(Articles::getFullImageByArticle($offer->article)),
|
||||
'latin' => $offer->article->product->specie->latin ?? false,
|
||||
];
|
||||
}
|
||||
return $data ?? false;
|
||||
|
||||
Reference in New Issue
Block a user