Hi Max!
Thanks for add this!!:
http://forum.virtuemart.net/index.php?topic=101724.0Whe have another similar problem with the searches.
When we search two or more words it only find results if the words are exacly
Example:
- Search "Sony Vaio" found "Sony Vaio YB3V1E"
- Search "Sony YB3V1E" found nothing!! Because this mach don't are exactly in the product name, the product name is "Sony Vaio YB3V1E"
We repaired quickly:
in the file administrator/components/com_virtuemart/models/product.php in line 222 aprox.
replace:
$filter_search[] = '`'.$searchField.'` LIKE '.$keyword;
by:
$keywords_plural = preg_replace('/\s+/', '%" AND `'.$searchField.'` LIKE "%', $keyword);
$filter_search[] = '`'.$searchField.'` LIKE '.$keywords_plural;
It's a little reparation, we replace blank space with searchfield:
Array of search fields before:
Array
(
- => `product_name` LIKE "%asus network%"
- [1] => `product_sku` LIKE "%asus network%"
[2] => `product_s_desc` LIKE "%asus network%"
[3] => `category_name` LIKE "%asus network%"
[4] => `mf_name` LIKE "%asus network%"
)
Array of seach fields after:
Array
(
- => `product_name` LIKE "%asus%" AND `product_name` LIKE "%network%"
- [1] => `product_sku` LIKE "%asus%" AND `product_sku` LIKE "%network%"
[2] => `product_s_desc` LIKE "%asus%" AND `product_s_desc` LIKE "%network%"
[3] => `category_name` LIKE "%asus%" AND `category_name` LIKE "%network%"
[4] => `mf_name` LIKE "%asus%" AND `mf_name` LIKE "%network%"
)
Thanks!!