Fix search sorting
This commit is contained in:
parent
95be1bb321
commit
154403d06f
|
|
@ -77,6 +77,7 @@ class ProductRepository extends WProductRepository
|
||||||
{
|
{
|
||||||
$channel = core()->getRequestedChannelCode();
|
$channel = core()->getRequestedChannelCode();
|
||||||
|
|
||||||
|
$params = request()->input();
|
||||||
$locale = core()->getRequestedLocaleCode();
|
$locale = core()->getRequestedLocaleCode();
|
||||||
|
|
||||||
if (config('scout.driver') == 'algolia') {
|
if (config('scout.driver') == 'algolia') {
|
||||||
|
|
@ -138,16 +139,6 @@ class ProductRepository extends WProductRepository
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/* added for api as per the documentation */
|
|
||||||
if (isset($params['name'])) {
|
|
||||||
$query->where('product_flat.name', 'like', '%' . urldecode($params['name']) . '%');
|
|
||||||
}
|
|
||||||
|
|
||||||
/* added for api as per the documentation */
|
|
||||||
if (isset($params['url_key'])) {
|
|
||||||
$query->where('product_flat.url_key', 'like', '%' . urldecode($params['url_key']) . '%');
|
|
||||||
}
|
|
||||||
|
|
||||||
# sort direction
|
# sort direction
|
||||||
$orderDirection = 'asc';
|
$orderDirection = 'asc';
|
||||||
if (isset($params['order']) && in_array($params['order'], ['desc', 'asc'])) {
|
if (isset($params['order']) && in_array($params['order'], ['desc', 'asc'])) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue