Fix merge ricerca maggiore/minore
This commit is contained in:
parent
fb91845eb6
commit
dbc27e3217
|
@ -147,9 +147,26 @@ class Query
|
||||||
$search_query = '`color_title_'.$m[1].'`';
|
$search_query = '`color_title_'.$m[1].'`';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Gestione confronti
|
||||||
|
$real_value = trim(str_replace(['<', '>'], ['<', '>'], $value));
|
||||||
|
$more = starts_with($real_value, '>=') || starts_with($real_value, '> =') || starts_with($real_value, '>');
|
||||||
|
$minus = starts_with($real_value, '<=') || starts_with($real_value, '< =') || starts_with($real_value, '<');
|
||||||
|
|
||||||
|
if ($minus || $more) {
|
||||||
|
$sign = str_contains($real_value, '=') ? '=' : '';
|
||||||
|
if ($more) {
|
||||||
|
$sign = '>'.$sign;
|
||||||
|
} else {
|
||||||
|
$sign = '<'.$sign;
|
||||||
|
}
|
||||||
|
|
||||||
|
$value = trim(str_replace(['<', '=', '>'], '', $value));
|
||||||
|
$search_filters[] = 'CAST('.$search_query.' AS UNSIGNED) '.$sign.' '.prepare($value);
|
||||||
|
} else {
|
||||||
$search_filters[] = $search_query.' LIKE '.prepare('%'.$value.'%');
|
$search_filters[] = $search_query.' LIKE '.prepare('%'.$value.'%');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Ricerca
|
// Ricerca
|
||||||
if (!empty($search_filters)) {
|
if (!empty($search_filters)) {
|
||||||
|
|
Loading…
Reference in New Issue