Manage homepage by article, modify article template, enhance basket (add selector)
This commit is contained in:
@@ -18,11 +18,22 @@ class Offers
|
||||
public static function getBasket()
|
||||
{
|
||||
$basket = ShopCart::getContent();
|
||||
$offers = Offer::with(['variation', 'article.article_nature'])->whereIn('id', ShopCart::keys())->get();
|
||||
dump($basket->toArray());
|
||||
dump($offers->toArray());
|
||||
exit;
|
||||
return $data;
|
||||
// dump($basket->toArray());
|
||||
$offers = Offer::with(['variation', 'article.article_nature', 'article.image'])->whereIn('id', ShopCart::keys())->get();
|
||||
|
||||
foreach ($basket as $item) {
|
||||
$offer = $offers->where('id', $item->id)->first();
|
||||
$article_nature = strtolower($offer->article->article_nature->name);
|
||||
$data[$article_nature][] = [
|
||||
'id' => (int) $item->id,
|
||||
'name' => $item->name,
|
||||
'quantity' => (int) $item->quantity,
|
||||
'price' => $item->price,
|
||||
'variation' => $offer->variation->name,
|
||||
'image' => Articles::getPreviewSrc($offer->article->image),
|
||||
];
|
||||
}
|
||||
return $data ?? false;
|
||||
}
|
||||
|
||||
public static function getBasketData($id, $quantity = 1)
|
||||
|
||||
Reference in New Issue
Block a user