add methods to get icon on article natures

This commit is contained in:
Ludovic CANDELLIER
2023-09-12 23:00:36 +02:00
parent 419a4c2b9a
commit afaf0cc629
22 changed files with 583 additions and 155 deletions

View File

@@ -33,42 +33,21 @@ class CategoryController extends Controller
]);
if (count($articleNatures) === 1) {
$articleNature = $articleNatures[0];
} else {
$articleNature = 'semences';
}
$productTypes = Articles::getProductTypesWithOffers([
'category_id' => $categoryId,
]);
if (count($productTypes) === 1) {
$productType = $productTypes[0];
}
}
} else {
$productType = ArticleNatures::getProductTypeBySlug($articleNature);
}
switch ($articleNature) {
case 'semences':
$productType = 'botanic';
$articleNatureId = 1;
break;
case 'plants':
$productType = 'botanic';
$articleNatureId = 2;
break;
case 'legumes':
$productType = 'botanic';
$articleNatureId = 3;
break;
default:
if (!($productType ?? false)) {
$productType = 'botanic';
$articleNatureId = 1;
$articleNature = 'semences';
}
break;
}
// $productType = ArticleNatures::getProductType($articleNatureId);
// dump($productType);
// dump($articleNatureId);
// exit;
$articleNatureId = ArticleNatures::getIdBySlug($articleNature);
}
// exit;
$data = [
'category' => Categories::getFull($categoryId),
'breadcrumb' => Categories::getAncestorsByCategory($categoryId),
@@ -86,8 +65,6 @@ class CategoryController extends Controller
]),
'tags' => TagGroups::getWithTagsAndCountOffers($categoryId),
];
// dump($data);
// exit;
return view('Shop.Shelves.shelve', $data);
}