Prestashop: Product save fails when some categories have an apostrophe in the name

Created on 25 Jan 2019  Â·  14Comments  Â·  Source: PrestaShop/PrestaShop

Describe the bug
When some category's name have a simple quote in the name (apostrophe), like "Groomer's Edge", the admin product function (Catalog -> Products) fails. The ajax response of http://localhost:93/admin13/index.php/product/form/4113?_token=6hFyAu7qhrKcNgD4owW_57kcDctnhmB1zjHampxnFZI shows {"step1_categories_tree":["This value is not valid."]}.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Admin -> Catalog -> Categories, add a category called "Groomer's Edge", save
  2. Go to Admin -> Catalog -> Product, add a product, just type a name and save product
  3. See Response in Network tab of Chrome inspector.

Additionnal information
PrestaShop version: 1.7.5
PHP version: 7.2
Language : French

1.7.5.0 BO Bug No change required Products

Most helpful comment

Hi @thsantac,

I did not manage to reproduce the issue with PS1.7.4.4 also, but I checked your Database, I found in the table ps_category_shop, the root category(id_category=1) doesn't exist)
In your Databse, I run this command SQL Select * from ps_category_shop where id_category<3
I found this
image
=> the line which has id_category=1 is missing
Could you please run this command line

INSERT INTO `ps_category_shop`(`id_category`, `id_shop`, `position`) VALUES (1,1,0)
INSERT INTO `ps_category_shop`(`id_category`, `id_shop`, `position`) VALUES (1,2,0)

In my case, I found this
image
Thanks!

All 14 comments

Hi @thsantac,

I did not manage to reproduce the issue with PS1.7.5.0.
I attached a video record.
https://drive.google.com/file/d/1LPDCoaWaBbffj6tEz5ssFfwVXSPHMwBm/view
Thanks to check & feedback.

Yes after new testing, the diagnostic is wrong.
Each time I try to add a new product I have {"step1_categories_tree":["This value is not valid."]} in the ajax response and I don't know why... In PrestaShopBundle/Controller/Admin/ProductController.php, line 570, the "$form->isValid() fails.

Another confusion, this is not a bug in PS 1.7.5 but in 1.7.4.4 :-)

Hi @thsantac,

I tried also with PS1.7.4.4 & I did not manage to reproduce the issue.
https://drive.google.com/file/d/1bnlPlEgwljdBn0qb58WqUmWioJnDJliM/view
Have you a double name category?
Thanks!

You can seen the issue here : [Edited by @khouloudbelguith ]
Have to say the database has been migrated from 1.5 with Migration Pro module.
Thanks in advance

@thsantac,
This is a public space.
I removed your credentials from the comment.
Let's be safe!

Thanks!

It’s a test website, credentials will be changed anyway.

Thanks

Cordialement.

Bonne journée.

Thierry Santacana - 0630927608
thierry.[email protected]

Le 25 janv. 2019 à 17:12, khouloudbelguith notifications@github.com a écrit :

@thsantac https://github.com/thsantac,
This is a public space.
I removed your credentials from the comment.
Let's be safe!

Thanks!

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/PrestaShop/PrestaShop/issues/12307#issuecomment-457625085, or mute the thread https://github.com/notifications/unsubscribe-auth/AQXo1fy-D_lf3zxsweq0YhekEkHXQQ3nks5vGyzlgaJpZM4aSx1P.

@thsantac, did you have any override which is not compatible?
In your Project folder, could you please search for this expression "step1_categories_tree", it is provided by any override?
Thanks!

Hi,

There is no override in this project.

I have already searched for « step1_categories_tree » and found nothing.

I am lost...

Thierry Santacana
thierry.[email protected]

Le 25 janv. 2019 à 17:48, khouloudbelguith notifications@github.com a écrit :

@thsantac https://github.com/thsantac, did you have any override which is not compatible?
In your Project folder, could you please search for this expression "step1_categories_tree", it is provided by any override?
Thanks!

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/PrestaShop/PrestaShop/issues/12307#issuecomment-457637081, or mute the thread https://github.com/notifications/unsubscribe-auth/AQXo1dALky0bT2Oba35wrCMaOjdcn1ABks5vGzVHgaJpZM4aSx1P.

Hi,
Found the reason of the bug: products which are linked to "root" ("Home") category. If I remove the link between a product and the root category I am able to update a product.
Any idea?
Thanks

Hi @thsantac,

I did not manage to reproduce the issue with PS1.7.4.4 also, but I checked your Database, I found in the table ps_category_shop, the root category(id_category=1) doesn't exist)
In your Databse, I run this command SQL Select * from ps_category_shop where id_category<3
I found this
image
=> the line which has id_category=1 is missing
Could you please run this command line

INSERT INTO `ps_category_shop`(`id_category`, `id_shop`, `position`) VALUES (1,1,0)
INSERT INTO `ps_category_shop`(`id_category`, `id_shop`, `position`) VALUES (1,2,0)

In my case, I found this
image
Thanks!

Problem solved !!!

Thanks a lot.

@thsantac, thanks for your feedback.
Feel free to open a new one when needed.
Thanks!

just came to say THANK YOU!!!! had the same issue on prestashop 1.7.5 and no idea why... it just decided to stop working... after inserting the category it no longer throws errors, but for some reason, I have to change products from root category to something else (it throws the error on root).

Was this page helpful?
0 / 5 - 0 ratings