adapt display of article natures by disponibility of offers in shelve
This commit is contained in:
@@ -21,31 +21,28 @@ class CategoryController extends Controller
|
||||
|
||||
public function show(Request $request, $categoryId, $articleNatureId = false)
|
||||
{
|
||||
$productTypes = Articles::getProductTypesWithOffers([
|
||||
'category_id' => $categoryId,
|
||||
]);
|
||||
|
||||
$articleNatures = Articles::getArticleNaturesWithOffers([
|
||||
'category_id' => $categoryId,
|
||||
]);
|
||||
|
||||
if ($articleNatureId) {
|
||||
$productType = ArticleNatures::getProductType($articleNatureId);
|
||||
dump($productType);
|
||||
exit;
|
||||
} else {
|
||||
$articleNature = $request->input('article_nature');
|
||||
if (!$articleNature) {
|
||||
$articleNatures = Articles::getArticleNaturesWithOffers([
|
||||
'category_id' => $categoryId,
|
||||
]);
|
||||
if (! $articleNature) {
|
||||
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);
|
||||
}
|
||||
|
||||
$productType = ArticleNatures::getProductTypeBySlug($articleNature);
|
||||
$articleNatureId = ArticleNatures::getIdBySlug($articleNature);
|
||||
}
|
||||
$data = [
|
||||
@@ -65,6 +62,8 @@ class CategoryController extends Controller
|
||||
]),
|
||||
'tags' => TagGroups::getWithTagsAndCountOffers($categoryId),
|
||||
];
|
||||
// dump($data);
|
||||
// exit;
|
||||
return view('Shop.Shelves.shelve', $data);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user