From 909dbb51f01f0f6b161aafecd2de31d6f7a0710e Mon Sep 17 00:00:00 2001 From: rahul shukla Date: Wed, 14 Aug 2019 12:02:30 +0530 Subject: [PATCH] condition changes for category filter --- .../Http/Controllers/DashboardController.php | 4 +-- .../Controllers/RegistrationController.php | 2 +- .../list/layered-navigation.blade.php | 3 +- .../Theme/src/ViewRenderEventManager.php | 29 ++++++++++++++----- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/packages/Webkul/Admin/src/Http/Controllers/DashboardController.php b/packages/Webkul/Admin/src/Http/Controllers/DashboardController.php index 3be5ad0c8..b43d847a8 100755 --- a/packages/Webkul/Admin/src/Http/Controllers/DashboardController.php +++ b/packages/Webkul/Admin/src/Http/Controllers/DashboardController.php @@ -286,14 +286,14 @@ class DashboardController extends Controller private function getOrdersBetweenDate($start, $end) { return $this->order->scopeQuery(function ($query) use ($start, $end) { - return $query->where('orders.created_at', '>=', $start)->where('orders.created_at', '<=', $end); + return $query->where('orders.status', '<>', 'canceled')->where('orders.created_at', '>=', $start)->where('orders.created_at', '<=', $end); }); } private function getCustomersBetweenDates($start, $end) { return $this->customer->scopeQuery(function ($query) use ($start, $end) { - return $query->where('customers.created_at', '>=', $start)->where('customers.created_at', '<=', $end); + return $query->where('customers.created_at', '>=', $start)->where('customers.created_at', '<=', $end)->where('customers.status', '=', 1); }); } } \ No newline at end of file diff --git a/packages/Webkul/Customer/src/Http/Controllers/RegistrationController.php b/packages/Webkul/Customer/src/Http/Controllers/RegistrationController.php index 53c72926f..2b58ed665 100755 --- a/packages/Webkul/Customer/src/Http/Controllers/RegistrationController.php +++ b/packages/Webkul/Customer/src/Http/Controllers/RegistrationController.php @@ -75,7 +75,7 @@ class RegistrationController extends Controller $data['is_verified'] = 1; } - $data['customer_group_id'] = $this->customerGroup->findOneWhere(['code' => 'general'])->id; + $data['customer_group_id'] = 1; $verificationData['email'] = $data['email']; $verificationData['token'] = md5(uniqid(rand(), true)); diff --git a/packages/Webkul/Shop/src/Resources/views/products/list/layered-navigation.blade.php b/packages/Webkul/Shop/src/Resources/views/products/list/layered-navigation.blade.php index 300f033db..2be61ffff 100755 --- a/packages/Webkul/Shop/src/Resources/views/products/list/layered-navigation.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/products/list/layered-navigation.blade.php @@ -6,9 +6,10 @@ getAll($category->id); if (isset($category)) { + $products = $productRepository->getAll($category->id); + if (count($category->filterableAttributes) > 0 && count($products)) { $filterAttributes = $category->filterableAttributes; } else { diff --git a/packages/Webkul/Theme/src/ViewRenderEventManager.php b/packages/Webkul/Theme/src/ViewRenderEventManager.php index d4855edc1..735730594 100755 --- a/packages/Webkul/Theme/src/ViewRenderEventManager.php +++ b/packages/Webkul/Theme/src/ViewRenderEventManager.php @@ -1,9 +1,6 @@ templates; } + /** + * get params + * + * @return array + */ + public function getParams() + { + return $this->params; + } + + /** + * get param + * + * @param $name + * + * @return mixed + */ + public function getParam($name) + { + return optional($this->params)[$name]; + } /** * Add templates for render * @@ -46,7 +62,6 @@ class ViewRenderEventManager { array_push($this->templates, $template); } - /** * Renders templates * @@ -55,13 +70,11 @@ class ViewRenderEventManager public function render() { $string = ""; - foreach ($this->templates as $template) { if (view()->exists($template)) { $string .= view($template, $this->params)->render(); } } - return $string; } } \ No newline at end of file