Fix ajax search product that return bad json response
This commit is contained in:
parent
8f7371cdf0
commit
cd08690646
@ -171,17 +171,23 @@ else
|
||||
top_httphead();
|
||||
|
||||
if (empty($htmlname))
|
||||
return;
|
||||
{
|
||||
print json_encode(array());
|
||||
return;
|
||||
}
|
||||
|
||||
$match = preg_grep('/(' . $htmlname . '[0-9]+)/', array_keys($_GET));
|
||||
sort($match);
|
||||
|
||||
$idprod = (! empty($match[0]) ? $match[0] : '');
|
||||
|
||||
if (! GETPOST($htmlname) && ! GETPOST($idprod))
|
||||
return;
|
||||
if (GETPOST($htmlname) == '' && ! GETPOST($idprod))
|
||||
{
|
||||
print json_encode(array());
|
||||
return;
|
||||
}
|
||||
|
||||
// When used from jQuery, the search term is added as GET param "term".
|
||||
// When used from jQuery, the search term is added as GET param "term".
|
||||
$searchkey = (GETPOST($idprod) ? GETPOST($idprod) : (GETPOST($htmlname) ? GETPOST($htmlname) : ''));
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user