Guest Posted June 13, 2007 Posted June 13, 2007 Hi Group, it is almost unbelievable that apparently this topic never has been approached: Many non-English shops sell products with descriptions that contains diacritics (äöü or èé ß ...) Users, who do not own the appropriate keyboard will try using their substitutes (aou, e or ss) instead. Currently OSCommerce _would find nothing_ in this case. I couldn't either find a suitable contribution. Is something existing in our galaxy? Where I just not able to operate the search of this contribution board? ;-) Thank you in advance for your help RIN67630
oschellas Posted June 13, 2007 Posted June 13, 2007 In advanced_search_result.php after line 49 I inserted following function: /* tommod added function for undistinguished punctuation search */ function gr_regexp($mystring){ $replacement=array( array("Ά","Α","α","ά"), array("Έ","Ε","ε","έ"), array("Ή","Η","η","ή"), array("Ί","Ι","ι","ί","ϊ","ΐ"), array("Ό","Ο","ο","ό"), array("Ύ","Υ","υ","ύ","ϋ","ΰ"), array("Ώ","Ω","ω","ώ") ); foreach($replacement as $group){ foreach($group as $character){ $exp="["; foreach($group as $expcharacter){ $exp.=$expcharacter; } $exp.="]"; $trans[$character]=$exp; } } $temp=explode(" ", $mystring); for ($i=0;$i<sizeof($temp);$i++){ $temp[$i]=strtr($temp[$i],$trans); $temp[$i]=addslashes($temp[$i]); } return implode(".*",$temp); } On line 259 from the same file I changed: $keyword = tep_db_prepare_input($search_keywords[$i]); To: $keyword_tmp = tep_db_prepare_input($search_keywords[$i]); $keyword = gr_regexp($keyword_tmp); You can change the function gr_regexp to reflect your language (the example is done for Greek), or create multiple functions like this if your shop uses multiple languages
Guest Posted June 13, 2007 Posted June 13, 2007 In advanced_search_result.php after line 49 I insert following function: /* tommod added function for undistinguished punctuation search */function gr_regexp($mystring){ $replacement=array( array("Ά","Α","α","ά"), array("Έ","Ε","ε","έ"), array("Ή","Η","η","ή"), array("Ί","Ι","ι","ί","ϊ","ΐ"), array("Ό","Ο","ο","ό"), array("Ύ","Υ","υ","ύ","ϋ","ΰ"), array("Ώ","Ω","ω","ώ") );... Wow! I am very impressed! Thank you for that fast reaction.So, if I did understand you correctly everyone can put in the array list of equivalent characters, isn't it?I am not a programmer, could you imagine that it would work with characters pairs as well? e.g. ae beeing equivalent to ä? I will try it as soon as possible anyway, whenever I got it to work i'll post a contribution for German/French/Spanish(including your name of course). Thanks again.RIN67630
oschellas Posted June 13, 2007 Posted June 13, 2007 So, if I did understand you correctly everyone can put in the array list of equivalent characters, isn't it? That is correct, I don't think it is a good idea to use multiple characters in the array like "u","ue" since it could generalize the search results too much, or eliminate words that supposed to be written with this combination. Anyway, I didn't try that, you could test it.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.