Display filters, and fix css for article

This commit is contained in:
Ludovic CANDELLIER
2022-01-22 13:12:43 +01:00
parent 6ff65eb927
commit 2912dc6794
7 changed files with 57 additions and 41 deletions

View File

@@ -64,8 +64,6 @@ class Articles
public static function getArticlesToSell()
{
$articles = self::getArticlesWithOffers();
// dump($articles->toArray());
// exit;
foreach ($articles as $article) {
$price_lists = $article->offers[0]->tariff->price_lists->toArray();
// dump($price_lists);
@@ -75,6 +73,8 @@ class Articles
'image' => $article->image,
'product_type' => $article->product_type,
'product_id' => $article->product_id,
'product_name' => $article->product->name,
'parent_name' => trim(str_replace($article->product->name, '', $article->name)),
];
$prices = $price_lists[0]['price_list_values'][0];
$article_nature_name = strtolower($article->article_nature->name);

View File

@@ -2,17 +2,11 @@
namespace App\Repositories\Shop;
use Yajra\DataTables\DataTables;
use App\Models\Shop\TagGroup;
use App\Models\Shop\Tag;
class TagGroups
{
public static function getDatatable()
{
$model = TagGroup::query();
return Datatables::of($model)->make(true);
}
public static function getOptions()
{
@@ -21,7 +15,17 @@ class TagGroups
public static function getWithTagsAndCountOffers()
{
return TagGroup::with('tags')->withCount(['tags.articles'])->get()->toArray();
$tags = Tag::withCount(['articles'])->get()->toArray();
$tag_groups = TagGroup::pluck('name','id')->toArray();
foreach ($tags as $tag) {
$data[$tag['tag_group_id']]['name'] = $tag_groups[$tag['tag_group_id']];
$data[$tag['tag_group_id']]['tags'][] = [
'id' => $tag['id'],
'name' => $tag['name'],
'count' => $tag['articles_count'],
];
}
return $data;
}
public static function getTreeTags()