category check condition for sorting
This commit is contained in:
parent
f9863f440f
commit
2f2f97a6d0
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
@ -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"
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue