oklok Posted January 16, 2022 Share Posted January 16, 2022 So Prestashop V.1.7 have this std setting in friendly URL to re-write ö=oe , ä=ae, any tips on how to proceed to make so the automatic friendly url rewrite ö= o and ä=a? For sure can enable accented URL but not recommended as some browser not compatible with åäö so preferbly is as mention above. Link to comment Share on other sites More sharing options...
SmartDataSoft Posted January 18, 2022 Share Posted January 18, 2022 Hello, which language you are using. If describe we can test by reproduce that in localhost Thank you Link to comment Share on other sites More sharing options...
oklok Posted January 18, 2022 Author Share Posted January 18, 2022 Hello there 😄 In my case, that would be Swedish which uses ä and ö in the ABC. Example röst should in url rewrite to rost and not roest Link to comment Share on other sites More sharing options...
ps8modules Posted January 18, 2022 Share Posted January 18, 2022 ./classes/Tools.php Find function replaceAccentedChars Link to comment Share on other sites More sharing options...
oklok Posted January 18, 2022 Author Share Posted January 18, 2022 15 hours ago, 4you.software said: ./classes/Tools.php Find function replaceAccentedChars Thanks all! Maybe I did wrong but nothing happens when I change the unicode to the correct one, for example Ö should become o in friendly url. (cash cleaned but still same outout ö=oe) As reference (http://www.tachyonsoft.com/uc0000.htm#U00D6) å: 00E5 ä: 00E4 ö: 00F6 Å: 00C5 Ä: 00C4 Ö: 00D6 The code: $patterns = [ /* Lowercase */ /* oe */ '/[\x{00F6}]/u', /* Uppercase */ /* OE */ '/[\x{00D6}]/u', Link to comment Share on other sites More sharing options...
ComGrafPL Posted January 18, 2022 Share Posted January 18, 2022 Isnt ö is: U+00F6 and UTF-8 is C3 B6 Link to comment Share on other sites More sharing options...
oklok Posted January 18, 2022 Author Share Posted January 18, 2022 2 minutes ago, ComGrafPL said: Isnt ö is: U+00F6 and UTF-8 is C3 B6 Yes but Prestashop have it in Unicode. Link to comment Share on other sites More sharing options...
ps8modules Posted January 18, 2022 Share Posted January 18, 2022 Take a look at the str2url function. You can use str_replace in this function. Link to comment Share on other sites More sharing options...
ps8modules Posted January 18, 2022 Share Posted January 18, 2022 static $allow_accented_chars = null; $str = str_replace(array('Ö', 'ö', 'Ë', 'ë'), array('O', 'o', 'E', 'e'), $str); Link to comment Share on other sites More sharing options...
oklok Posted January 18, 2022 Author Share Posted January 18, 2022 9 minutes ago, 4you.software said: static $allow_accented_chars = null; $str = str_replace(array('Ö', 'ö', 'Ë', 'ë'), array('O', 'o', 'E', 'e'), $str); Thx. Am I doing something wrong here? did not get it to work... Link to comment Share on other sites More sharing options...
ps8modules Posted January 18, 2022 Share Posted January 18, 2022 Where is it not visible? You have to open where the badly generated url is and have it generated again, or write a script to change all the urls stored in the database. Link to comment Share on other sites More sharing options...
oklok Posted January 18, 2022 Author Share Posted January 18, 2022 (edited) 5 minutes ago, 4you.software said: Where is it not visible? You have to open where the badly generated url is and have it generated again, or write a script to change all the urls stored in the database. When generating a new cms page and insert something in title it still generates oe. I will test again, and again thanks for your advice. Write script for old url, ok noted. Edited January 18, 2022 by oklok (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now