Prestashop: URL Rewrite problem

Created on 7 Jul 2020  ·  17Comments  ·  Source: PrestaShop/PrestaShop

When you generate url in product > seo tab

If there are special characters in the product title, and the url is generated with the button for creation, these are not removed and the url is wrong, you have to correct it manually.

  • PrestaShop version: 1.7.6.6 and above
  • PHP version: 7.2

Here are screenshots of the problem

Schermata 2020-07-07 alle 19 08 13
Schermata 2020-07-07 alle 19 15 14

1.7.6.6 BO Bug Minor No change required Products

Most helpful comment

Hi
I've created a new topic to reopen the case

https://github.com/PrestaShop/PrestaShop/issues/21495

All 17 comments

Thanks for opening this issue! We will help you to keep its state consistent

Hello @Betafer

What do you mean by "the url is generated with the button for creation" ?

If in your product name there is some specials characters non authorized in the URL they are automatically removed of the friendly-url field

Hello
The button generate friendly url..
, as i tell is not so ....

In your product page > SEO tab
When you click on "Reinitialize URL" you should see your friendly url with no error.

In your product page > SEO tab
When you click on "Reinitialize URL" you should see your friendly url with no error.

when i click Reinitialize URL the url is with error

Did you do a migration or is it a fresh install ?
Could you share a screen record and the steps to reproduce your issue please ?

migration from 1.5, soon i will make the screen record

Ok thanks for the clarification.
It only happens when you are using multilanguage.
I tried on my test shop with EL, FR, LT and I can't reproduce your issue.

Could you take a look at the console ? right-click > inspect element
And check for errors.

There is another problem with url friendly button, that it changes all languages, so if i change a url manually in one language, and than i change language and set url with the Reinitialize URL, it also change url in the language that i have correct manually

Hi @Betafer,

I did not manage to reproduce the issue with PS1.7.6.7.
I attached a screen record
https://drive.google.com/file/d/1l8uHDwyGCGrvKD0bGvDtevMb1mpoqibJ/view?usp=sharing

Could you please provide us with more info? We need more details to understand how we can reproduce your issue:

  • host
  • server setup and configuration
  • PrestaShop version (source)
  • debug mode report
  • PHP error logs
  • apache error log
  • javascript console log

Don't you know how to get this information? Please read the following article:
http://build.prestashop.com/howtos/misc/how-to-create-bug-report/

Thanks!

Hi @Betafer,

Since we had no news from you for more than 20 days, I'll close this ticket. Feel free to open another one if you can give specific details.

Thanks!

hi
the problem shown by this ticket is that the Tools::link_rewrite doesn't remove the strange characters
if you seen in the title there is an " but it is not a regular, it is an oblique apex
it should be removed by that function

” is different from "
the first has 226 unicode value the second 34
using ord()
I've seen that it is the
”

https://stackoverflow.com/questions/6931386/how-to-convert-this-to-htmlcharacters-and
they are called fancy or smart quotes

bye

it is necessary to use this code

$beta_name = htmlentities($beta_name, ENT_QUOTES); $beta_name = str_replace(array('”', '“'), '"', $beta_name); $beta_name = html_entity_decode($beta_name);

Same problem with prestashop 1.7.6.8 ...
Uploading Schermata 2020-10-18 alle 21.05.27.png…

Hi @khouloudbelguith and @marionf
can you reopen this topic? now I've inderstood the reason of this problem and it is possible to reproduce it
it is present in all prestashop 1.7 versions

1

it happens when it is active the option "Accented URLs"
when this option is active the function
Tools::link_rewrite
works well with special characters removing it excepts accented characters, instead from the product page pushing on the button "reset url" from seo tab, it does not work adding the special characters like quotes or ² or ³ ...

so to reproduce it following this steps:
1) active the option "Accented URLs"
2) go in an admin product page and set a name like:

Pantalon de travail multipoches en T/C canvas 260 g/m², empiècements en Oxford, gris - Beta 7900E

3) push on the "reset url" button

this problem is not present with disabled the option "Accented URLs", the "reset url" button remove the special characters

2
3

it is a javascript bug, the "reset url" button active a javacript cleaning, it should use an ajax solution to use Tools::link_rewrite

bye

Hi
I've created a new topic to reopen the case

https://github.com/PrestaShop/PrestaShop/issues/21495

Was this page helpful?
0 / 5 - 0 ratings