Jump to content

prestashop 1.7.4.3 search not works for Chinese in front end


Jack

Recommended Posts

Finally found the reason and a workaround:

In classes/Search.php, in function sanitize() at about line 167,

$string = Tools::replaceAccentedChars(trim(preg_replace('/\s+/', ' ', $string)));

replace it with,

$string = Tools::replaceAccentedChars($string);

Then searching works with Chinese words.

Notes: my version is 1.7.4.3

Link to comment
Share on other sites

  • Jack changed the title to prestashop 1.7.4.3 search not work for Chinese in front end

Finally found the solution, just replace the line mentioned above with,

$string = Tools::replaceAccentedChars(trim(preg_replace('/[\pZ\pC]+/u', ' ', $string)));

Also, comment out lines about splitting symbols(also chinese characters) to single words, see attached file for details.

Then rebuild search index and everything will work.

Search.php

Link to comment
Share on other sites

  • Jack changed the title to prestashop 1.7.4.3 search not works for Chinese in front end

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...