diff --git a/app/Http/Controllers/Shop/SearchController.php b/app/Http/Controllers/Shop/SearchController.php index 6504bb1c..5c67329f 100644 --- a/app/Http/Controllers/Shop/SearchController.php +++ b/app/Http/Controllers/Shop/SearchController.php @@ -13,8 +13,9 @@ class SearchController extends Controller { $data = self::init(); $data['articles'] = Searches::getResults($request->input()); - $data['articles_count'] = count($data['articles']); + $data['articles_count'] = $data['articles'] ? count($data['articles']) : 0; $data['search'] = $request->input(); + $data['product_type'] = $request->input('product_type'); return view('Shop.Search.results', $data); } } diff --git a/app/Repositories/Shop/Articles.php b/app/Repositories/Shop/Articles.php index f1a8c250..afe7eb69 100644 --- a/app/Repositories/Shop/Articles.php +++ b/app/Repositories/Shop/Articles.php @@ -228,7 +228,14 @@ class Articles $model = $search ? $model->search($search) : $model; $model = $article_nature_id ? $model->byArticleNature($article_nature_id) : $model; $model = $article_nature_ids ? $model->byArticleNatures($article_nature_ids) : $model; - $model = ($product_type == 'botanic') ? $model->botanic() : $model->merchandise(); + switch ($product_type) { + case 'botanic': + $model = $model->botanic(); + break; + case 'merchandise': + $model = $model->merchandise(); + break; + } return $model; } diff --git a/app/Repositories/Shop/Searches.php b/app/Repositories/Shop/Searches.php index 6c8e925e..42563190 100644 --- a/app/Repositories/Shop/Searches.php +++ b/app/Repositories/Shop/Searches.php @@ -8,7 +8,6 @@ class Searches { public static function getResults($options) { - $data = Articles::getArticlesToSell($options); - return $data; + return Articles::getArticlesToSell($options); } } diff --git a/resources/views/Shop/layout/partials/search.blade.php b/resources/views/Shop/layout/partials/search.blade.php index 5ee0a630..68c06632 100644 --- a/resources/views/Shop/layout/partials/search.blade.php +++ b/resources/views/Shop/layout/partials/search.blade.php @@ -1,8 +1,16 @@ -