Added natural search to product line search

This commit is contained in:
Raphaël Doursenaud 2013-03-15 16:05:49 +01:00
parent 656915b8a8
commit 16efed11ca

View File

@ -13,6 +13,7 @@
* Copyright (C) 2010 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -1223,9 +1224,13 @@ class Form
}
else
{
$sql.=" AND (p.ref LIKE '%".$filterkey."%' OR p.label LIKE '%".$filterkey."%'";
if (! empty($conf->global->MAIN_MULTILANGS)) $sql.=" OR pl.label LIKE '%".$filterkey."%'";
$sql.=")";
// For natural search
$scrit = explode(' ', $filterkey);
foreach ($scrit as $crit) {
$sql.=" AND (p.ref LIKE '%".$crit."%' OR p.label LIKE '%".$crit."%'";
if (! empty($conf->global->MAIN_MULTILANGS)) $sql.=" OR pl.label LIKE '%".$crit."%'";
$sql.=")";
}
}
if (! empty($conf->barcode->enabled))