Jump to content

Problem With Url


Recommended Posts

Hi,

PrestaShop 1.5.0.17 supported accented letters (Estonian letters) in URL: ä,ö,õ,ü.

Prestashop 1.5.0.17 URLs automatically generated from product names, and I did not change manually ä->a, ö->o etc. There was no need change letters, because all URLs works perfectly with ä, ö, ü, ö letters.

 

 

The problems began after upgrading 1.5.0.17 to 1.5.3.1

If I want change product info (such as price) and save, there are link_rewrite errors:

field link rewrite (English (English)) is wrong.

field link rewrite(Deutsch (German)) is wrong.

field link rewrite (Estonian) is wrong.

etc

 

What's up, why newest Prestashop doesn’t support accented letters in URL anymore?

  • Like 1
Link to comment
Share on other sites

It looks like there will be an option to enable accented characters in the next release...

 

To make it work now we should do the following:

===============================Override Validate.php===============================

open overrides/classes/Validate.php and add the following code there:

<?php
class Validate extends ValidateCore
{
public static function isLinkRewrite($link)
{
  return preg_match('/^[_a-zA-Z0-9\-\pL]+$/u', $link);
}
}

 

===============================Edit ADMIN.JS===============================

Open js/admin.js and remove the following lines:

if (PS_ALLOW_ACCENTED_CHARS_URL)

AND

else
{
 str = str.replace(/[\u0105\u0104\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5]/g,'a');
 str = str.replace(/[\u00E7\u010D\u0107\u0106]/g,'c');
 str = str.replace(/[\u010F]/g,'d');
 str = str.replace(/[\u00E8\u00E9\u00EA\u00EB\u011B\u0119\u0118\u0117]/g,'e');
 str = str.replace(/[\u00EC\u00ED\u00EE\u00EF\u012F]/g,'i');
 str = str.replace(/[\u0142\u0141]/g,'l');
 str = str.replace(/[\u00F1\u0148]/g,'n');
 str = str.replace(/[\u00F2\u00F3\u00F4\u00F5\u00F6\u00F8\u00D3]/g,'o');
 str = str.replace(/[\u0159]/g,'r');
 str = str.replace(/[\u015B\u015A\u0161]/g,'s');
 str = str.replace(/[\u00DF]/g,'ss');
 str = str.replace(/[\u0165]/g,'t');
 str = str.replace(/[\u00F9\u00FA\u00FB\u00FC\u016F\u016B\u0173]/g,'u');
 str = str.replace(/[\u00FD\u00FF]/g,'y');
 str = str.replace(/[\u017C\u017A\u017B\u0179\u017E]/g,'z');
 str = str.replace(/[\u00E6]/g,'ae');
 str = str.replace(/[\u0153]/g,'oe');
 str = str.replace(/[\u013E\u013A]/g,'l');
 str = str.replace(/[\u0155]/g,'r');
 str = str.replace(/[^a-z0-9\s\'\:\/\[\]-]/g,'');
}

Link to comment
Share on other sites

Another one solution is to insert PS_ALLOW_ACCENTED_CHARS_URL into the ps_configuration table and set value to 1 manually

or by executing sql query from phpMyAdmin

INSERT INTO `ps_configuration` (`id_shop_group`, `id_shop`, `name`, `value`, `date_add`, `date_upd`) VALUES (NULL, NULL, 'PS_ALLOW_ACCENTED_CHARS_URL', '1', '2013-01-01 00:00:00', '2013-01-01 00:00:00');

Link to comment
Share on other sites

×
×
  • Create New...