category check condition for sorting

This commit is contained in:
rahul shukla 2019-07-05 13:33:06 +05:30
parent f9863f440f
commit 2f2f97a6d0
2 changed files with 13 additions and 3 deletions

View File

@ -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');
}
}

View File

@ -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"
},