Manage homepage by article, modify article template, enhance basket (add selector)

This commit is contained in:
Ludovic CANDELLIER
2022-03-24 00:48:26 +01:00
parent ddc5f2664c
commit c65056531c
13 changed files with 277 additions and 148 deletions

View File

@@ -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)