From f9863f440f6a4b65a50b0175d2c27a8e302037bf Mon Sep 17 00:00:00 2001 From: rahul shukla Date: Fri, 5 Jul 2019 13:24:46 +0530 Subject: [PATCH 1/2] category check condition for sorting --- .../Resources/views/products/list/layered-navigation.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 2825932f8..ca86cfaeb 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 @@ -146,7 +146,7 @@ 0, 0 ], - max: {{ core()->convertPrice($productFlatRepository->getMaximumPrice($category->id)) }}, + max: {{ isset($category) ? core()->convertPrice($productFlatRepository->getMaximumPrice($category->id)) : core()->convertPrice(500) }}, processStyle: { "backgroundColor": "#FF6472" }, From 2f2f97a6d07a670cc3be9e51b961e8c913421870 Mon Sep 17 00:00:00 2001 From: rahul shukla Date: Fri, 5 Jul 2019 13:33:06 +0530 Subject: [PATCH 2/2] category check condition for sorting --- .../src/Repositories/ProductFlatRepository.php | 14 ++++++++++++-- .../products/list/layered-navigation.blade.php | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/Webkul/Product/src/Repositories/ProductFlatRepository.php b/packages/Webkul/Product/src/Repositories/ProductFlatRepository.php index 0179bc29d..2d7c82a82 100644 --- a/packages/Webkul/Product/src/Repositories/ProductFlatRepository.php +++ b/packages/Webkul/Product/src/Repositories/ProductFlatRepository.php @@ -37,16 +37,26 @@ class ProductFlatRepository extends Repository } /** - * Maximum Price of Prodcut + * Maximum Price of Category Prodcut * * @param int $categoryId * return integer */ - public function getMaximumPrice($categoryId) + public function getCategoryProductMaximumPrice($categoryId) { return $this->model ->leftJoin('product_categories', 'product_flat.product_id', 'product_categories.product_id') ->where('product_categories.category_id', $categoryId) ->max('price'); } + + /** + * Maximum Price of Prodcut + * + * return integer + */ + public function getProductMaximumPrice() + { + return $this->model->max('price'); + } } \ No newline at end of file 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 ca86cfaeb..333b5342a 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 @@ -146,7 +146,7 @@ 0, 0 ], - max: {{ isset($category) ? core()->convertPrice($productFlatRepository->getMaximumPrice($category->id)) : core()->convertPrice(500) }}, + max: {{ isset($category) ? core()->convertPrice($productFlatRepository->getCategoryProductMaximumPrice($category->id)) : core()->convertPrice($productFlatRepository->getProductMaximumPrice()) }}, processStyle: { "backgroundColor": "#FF6472" },