From dde59a0c9022c33c4618a71945d6236a2c5d71e5 Mon Sep 17 00:00:00 2001 From: Ludovic CANDELLIER Date: Wed, 30 Mar 2022 16:34:08 +0200 Subject: [PATCH] Fixes on grouping --- app/Http/Controllers/Shop/CategoryController.php | 2 +- app/Repositories/Shop/Articles.php | 8 +------- resources/views/Shop/Articles/partials/article.blade.php | 4 ++-- .../views/Shop/Homepage/partials/sliderByShelve.blade.php | 2 +- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/app/Http/Controllers/Shop/CategoryController.php b/app/Http/Controllers/Shop/CategoryController.php index 91bd26e9..b9a59f33 100644 --- a/app/Http/Controllers/Shop/CategoryController.php +++ b/app/Http/Controllers/Shop/CategoryController.php @@ -23,7 +23,7 @@ class CategoryController extends Controller $data = self::init(); $data['display_by_rows'] = $request->input('by_rows') ?? false; $data['category'] = Categories::getFull($category_id); - $data['articles'] = Articles::getArticlesToSell($category_id); + $data['articles'] = Articles::getArticlesToSell(['category_id' => $category_id]); $data['tags'] = TagGroups::getWithTagsAndCountOffers(); return view('Shop.shelve', $data); } diff --git a/app/Repositories/Shop/Articles.php b/app/Repositories/Shop/Articles.php index b4969bea..b216d4e0 100644 --- a/app/Repositories/Shop/Articles.php +++ b/app/Repositories/Shop/Articles.php @@ -145,13 +145,8 @@ class Articles public static function getArticlesToSell($options) { $articles = self::getArticlesWithOffers($options); - // dump($options); - // dump($articles->toArray()); - // exit; - /* foreach ($articles as $article) { $price_lists = $article->offers[0]->tariff->price_lists->toArray(); - dump($price_lists); if (count($price_lists)) { if (!is_array($data[$article->name] ?? false)) { $data[$article->name] = self::getDataForSale($article); @@ -161,8 +156,7 @@ class Articles $data[$article->name][$article_nature_name] = self::getDataPriceForSale($article, $prices); } } - */ - return $articles ?? false; + return $data ?? false; } public static function getDataForSale($article) diff --git a/resources/views/Shop/Articles/partials/article.blade.php b/resources/views/Shop/Articles/partials/article.blade.php index 1cb04564..64ccec59 100644 --- a/resources/views/Shop/Articles/partials/article.blade.php +++ b/resources/views/Shop/Articles/partials/article.blade.php @@ -1,7 +1,7 @@
@if ($article['image'] !== null) - {{ $article['product_name'] }} + {{ $product_name }} @else @endif @@ -9,7 +9,7 @@