Fixes on grouping

This commit is contained in:
Ludovic CANDELLIER
2022-03-30 16:34:08 +02:00
parent 1dced19068
commit dde59a0c90
4 changed files with 5 additions and 11 deletions

View File

@@ -23,7 +23,7 @@ class CategoryController extends Controller
$data = self::init(); $data = self::init();
$data['display_by_rows'] = $request->input('by_rows') ?? false; $data['display_by_rows'] = $request->input('by_rows') ?? false;
$data['category'] = Categories::getFull($category_id); $data['category'] = Categories::getFull($category_id);
$data['articles'] = Articles::getArticlesToSell($category_id); $data['articles'] = Articles::getArticlesToSell(['category_id' => $category_id]);
$data['tags'] = TagGroups::getWithTagsAndCountOffers(); $data['tags'] = TagGroups::getWithTagsAndCountOffers();
return view('Shop.shelve', $data); return view('Shop.shelve', $data);
} }

View File

@@ -145,13 +145,8 @@ class Articles
public static function getArticlesToSell($options) public static function getArticlesToSell($options)
{ {
$articles = self::getArticlesWithOffers($options); $articles = self::getArticlesWithOffers($options);
// dump($options);
// dump($articles->toArray());
// exit;
/*
foreach ($articles as $article) { foreach ($articles as $article) {
$price_lists = $article->offers[0]->tariff->price_lists->toArray(); $price_lists = $article->offers[0]->tariff->price_lists->toArray();
dump($price_lists);
if (count($price_lists)) { if (count($price_lists)) {
if (!is_array($data[$article->name] ?? false)) { if (!is_array($data[$article->name] ?? false)) {
$data[$article->name] = self::getDataForSale($article); $data[$article->name] = self::getDataForSale($article);
@@ -161,8 +156,7 @@ class Articles
$data[$article->name][$article_nature_name] = self::getDataPriceForSale($article, $prices); $data[$article->name][$article_nature_name] = self::getDataPriceForSale($article, $prices);
} }
} }
*/ return $data ?? false;
return $articles ?? false;
} }
public static function getDataForSale($article) public static function getDataForSale($article)

View File

@@ -1,7 +1,7 @@
<a href="{{ route('Shop.Articles.show', ['id' => $article['semences']['article_id'] ?? false ]) }}"> <a href="{{ route('Shop.Articles.show', ['id' => $article['semences']['article_id'] ?? false ]) }}">
<div class="card"> <div class="card">
@if ($article['image'] !== null) @if ($article['image'] !== null)
<img src="{{ App\Repositories\Shop\Articles::getPreviewSrc($article['image'] ?? false) }}" class="card-img-top" alt="{{ $article['product_name'] }}"> <img src="{{ App\Repositories\Shop\Articles::getPreviewSrc($article['image'] ?? false) }}" class="card-img-top" alt="{{ $product_name }}">
@else @else
<img src="img/visuel-non-disponible.jpg" class="card-img-top"> <img src="img/visuel-non-disponible.jpg" class="card-img-top">
@endif @endif
@@ -9,7 +9,7 @@
<div class="row card-title"> <div class="row card-title">
<div class="col-10" style="font-weight: bold; color: green;"> <div class="col-10" style="font-weight: bold; color: green;">
<h2 style="font-size: 1.3em;">{{ $article['parent_name'] }}</h2> <h2 style="font-size: 1.3em;">{{ $article['parent_name'] }}</h2>
{{ $article['product_name'] }} {{ $product_name }}
</div> </div>
<div class="col-2 p-0 text-right" style="font-size: 2em; color: red;"> <div class="col-2 p-0 text-right" style="font-size: 2em; color: red;">
<i class="fa fa-heart"></i> <i class="fa fa-heart"></i>

View File

@@ -14,7 +14,7 @@
<div class="text-center pr-2 pl-2"> <div class="text-center pr-2 pl-2">
<a href="{{ route('Shop.Articles.show', ['id' => $article['id']]) }}"> <a href="{{ route('Shop.Articles.show', ['id' => $article['id']]) }}">
<img data-lazy="{{ App\Repositories\Shop\Articles::getPreviewSrc($article['image'] ?? false) }}" class="d-block w-100" alt="{{ $name }}"/> <img data-lazy="{{ App\Repositories\Shop\Articles::getPreviewSrc($article['image'] ?? false) }}" class="d-block w-100" alt="{{ $name }}"/>
{{ $article['name'] }} {{ $name }}
</a> </a>
</div> </div>
@endforeach @endforeach