Hi all,
I have a little problem with the VM search module.
Situation:
- I have product with title "čelenka"
- when my search string is "čelenka", module find him - this is ok
- but when I try "celenka" (č - c), module can not find the product
My question is:
- this is standard situation?
- when no, is problem with language settings? Shop language is slovak, but VM was installed in the EN language (I think)
- it is necessary to modify the search plugin?
thx
ok, I found solution. (J v3.8.8 + VM v3.2.14)
1. go to
/plugins/search/ and duplicate (and rename e.g. virtuemartMod) folder "virtuemart"
2. rename files
virtuemart.php and
virtuemart.xml to e.g.
virtuemartMod.php and
virtuemartMod.xml3. open
virtuemartMod.xml and rename:
from
<filename plugin="virtuemart">virtuemart.php</filename>
to
<filename plugin="virtuemartMod">virtuemartMod.php</filename>
4. open
virtuemartMod.php rename class:
from
class plgSearchVirtuemart extends JPlugin
to
class plgSearchVirtuemartMod extends JPlugin
5. modily switch function about line 103 like this
Quoteswitch ($phrase) {
case 'exact':
$wheres2 = array();
// product_sku should be exact match
$text = $db->quote("%$text%", TRUE);
$wheres2[] = "p.product_sku LIKE $text";
$wheres2[] = "a.product_name COLLATE utf8_general_ci LIKE $text";
$wheres2[] = "b.$category_field COLLATE utf8_general_ci LIKE $text";
if ($search_product_s_description)
$wheres2[] = "a.product_s_desc COLLATE utf8_general_ci LIKE $text";
if ($search_product_description)
$wheres2[] = "a.product_desc COLLATE utf8_general_ci LIKE $text";
if ($search_customfields)
$wheres2[] = "(cf.customfield_value LIKE $text $customfield_ids_condition)";
$where = '(' . implode (') OR (', $wheres2) . ')';
break;
case 'all':
case 'any':
default:
$words = explode (' ', $text);
$wheres = array();
foreach ($words as $word) {
$wheres2 = array();
// product_sku should be exact match
$word = $db->quote("%$word%", TRUE);
$wheres2[] = "p.product_sku LIKE $word";
$wheres2[] = "a.product_name COLLATE utf8_general_ci LIKE $word";
$wheres2[] = "b.$category_field COLLATE utf8_general_ci LIKE $word";
if ($search_product_s_description)
$wheres2[] = "a.product_s_desc COLLATE utf8_general_ci LIKE $word";
if ($search_product_description)
$wheres2[] = "a.product_desc COLLATE utf8_general_ci LIKE $word";
if ($search_customfields)
$wheres2[] = "(cf.customfield_value LIKE $word $customfield_ids_condition)";
$wheres[] = implode (' OR ', $wheres2);
}
$where = '(' . implode (($phrase == 'all' ? ') AND (' : ') OR ('), $wheres) . ')';
break;
}
@milbo, it would not be bad to add COLLATE option to VM search.
yes, quite easy todo, just some work. The param needs to be added to the xml and needs language keys and translation.