Hi,
i want to display all product as search result like an OR query.
Es. i have a product: product blue one
If i find: "product" or "blue" or "one" the search show results.
If i find: "product one" the search give no results.
I want a query like: product_name LIKE "%product%" OR product_name LIKE "%one%", but Joomla debug show a query: product_name LIKE "%product one%"
so i try to edit file product.php in \administrator\components\com_virtuemart\models in this way:
$lista = explode(" ",$keyword);
$where[] = 'product_name LIKE %' .$lista[0].'% OR product_name LIKE %'.$lista[1].'% OR product_name LIKE %'.$lista[2].'%';
The code is valid max for 3 different word in the search form!
Can you help me? This code don't run!
In my case It works.
Line 225 change:
$keyword = $this->_db->getEscaped ($this->keyword, TRUE);
$mkeyword = explode(" ",$keyword);
$keyword = '"%' . $keyword . '%"';
Line 249 change:
if (strpos ($searchField, '`') !== FALSE){
/* $filter_search[] = $searchField . ' LIKE ' . $keyword;*/
foreach ($mkeyword as $mkw)
$filter_search[] = $searchField . ' LIKE ' . '"%' . $mkw . '%"';
} else {
/* $filter_search[] = '`' . $searchField . '` LIKE ' . $keyword;*/
foreach ($mkeyword as $mkw)
$filter_search[] = '`' . $searchField . '` LIKE ' . '"%' . $mkw . '%"';
}