Fixes on grouping

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

View File

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

View File

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

View File

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

View File

@@ -14,7 +14,7 @@
<div class="text-center pr-2 pl-2">
<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 }}"/>
{{ $article['name'] }}
{{ $name }}
</a>
</div>
@endforeach