Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.7.6.0 BO: A disabled category is not displayed in the "Parent category" section #14790

Closed
LimousinArcherie opened this issue Jul 20, 2019 · 10 comments

Comments

@LimousinArcherie
Copy link

commented Jul 20, 2019

Hi,
I'm in PS 1.7.6.0.
I try to update a category with meta description and simplified URL and the message "Une erreur inattendue s'est produite. [PrestaShop\PrestaShop\Core\Domain\Category\Exception\CategoryConstraintException code 6]".
I tried both on google chrome and microsoft edge.
Can you help me please?
Thanks!

[Edited by Khouloud]
A disabled category is not displayed in the "Parent category" section, which is not the same behavior as PS1.7.5.2.
To reproduce, go to Categories -> Home Edit and set "Displayed" to "No". Then try to add a new category.
If the Home category is disabled, we cannot add or edit categories.

Arnaud

@khouloudbelguith

This comment has been minimized.

Copy link
Contributor

commented Jul 22, 2019

Hi @LimousinArcherie,

I did not manage to reproduce the issue with PS1.7.6.0.
I attached a screen record
https://drive.google.com/file/d/1kPbe-zmD9VDxer2U2WgWjQIISGOQd6so/view
Could you please provide us with more info? We need more details to understand how we can reproduce your issue:

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

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!

@JulianEberius

This comment has been minimized.

Copy link
Contributor

commented Jul 23, 2019

Hi everyone,

I have the same issue. The CategoryConstraintException 6 happens on every edit of every category, and also when creating new categories. I updated to 1.7.6.0 using the 1-click updater. I was on the the most recent 1.7.5 before and the categories did work. I use the most recent Apache and PHP 7 that come with Ubuntu 18.04 .

My Javascript console (Safari/MacOS) shows "Error: Syntax error, unrecognized expression: input[name^="category[name]" when visiting the category editing page, and there is one visible problem: the category tree on the category edit page is completely empty, whether I create a top-level category or a child category:

CategoryTreeEmpty

When saving the category, I see no message in the Apache error log, only the error as above (CategoryConstraintException 6) in the BO.

Feel free to get back to me if you need more information.

edit: I'm fine with SQL so I created a new category in the database directly, and that worked fine. Seems to be a problem in the BO or JS code.

@khouloudbelguith

This comment has been minimized.

Copy link
Contributor

commented Jul 23, 2019

@JulianEberius, I did not manage to reproduce the issue with PS1.7.6.0 after upgrade from PS1.7.5.2 using the 1-click upgrade v4.9.0.
We need to retrieve the PHP error log and the debug mode report in order to find out what's wrong.
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!

@JulianEberius

This comment has been minimized.

Copy link
Contributor

commented Jul 23, 2019

Thanks for answering.

  • As mentioned, the php error log (/var/log/apache2/error.log) shows no messages when opening the category edit form (new category or edit existing category).
  • I have enabled debug mode and can see the Symfony profiler bar at the bottom. What output are you looking for?
  • As mentioned, the main difference to a working Prestashop (e.g. the Demo shop), is that the category tree in the category form is completely empty (not even root/home category present), and the the Javascript console has a error message that reads Error: Syntax error, unrecognized expression: input[name^="category[name]
  • However, the categories appear in the category list in BO and in the Front End, and I can see and even manipulate them in the database, so they are there. They just don't appear in this form.
@khouloudbelguith

This comment has been minimized.

Copy link
Contributor

commented Jul 24, 2019

@JulianEberius, during the upgrade, have you any errors displayed?
Can you please provide us the log of your upgrade? It can be found in the log.txt file, available in /autoupgrade/tmp/log.txt

Thanks!

@JulianEberius

This comment has been minimized.

Copy link
Contributor

commented Jul 28, 2019

The file contains 350K+ lines of "Copied file..." "Moved file..." etc.
It concludes with:

[2019-07-13 21:28:44] Database upgrade OK [2019-07-13 21:28:44] Warning detected during upgrade. [2019-07-13 21:28:44] Database upgraded. Now upgrading your Addons modules... [2019-07-13 21:28:45] Addons modules files have been upgraded. [2019-07-13 21:28:45] The database has been cleaned. [2019-07-13 21:28:46] Upgrade process done, but some warnings have been found. [2019-07-13 21:28:46] /var/www/html/hasibasi/autoupgrade/download/prestashop.zip removed [2019-07-13 21:28:46] /var/www/html/hasibasi/autoupgrade/latest removed

Anything in particular I should be looking for?

@khouloudbelguith

This comment has been minimized.

Copy link
Contributor

commented Jul 29, 2019

@LimousinArcherie, yes, I need if there are errors in your file during the upgrade.

Thanks!

@JulianEberius

This comment has been minimized.

Copy link
Contributor

commented Aug 4, 2019

Hi again. I've found the issue by stepping through the code with a debugger.

My shop's root/home category was set to "Displayed: No", because it was unused in the shop's frontend anyway. In this case, the method Category::getNestedCategories will return an empty array, because the SQL query there will not return the root category, and the following loop will not work without the root category in the result. The ChoiceTree in the BO form will then also be empty, and the form will be unable to save.

To reproduce, go to Categories -> Home Edit and set "Displayed" to "No". Then try to add a new category. The fix was to activate the root category again.

From my point of view the issue is fixed, but I still think this is a bug. Either the category forms should work even if the root category is invisible/disabled, or the use should not be allowed to disable this category.

@khouloudbelguith khouloudbelguith changed the title 1.7.6.0 BO: can't update category constraintexception 1.7.6.0 BO: A disabled category is not displayed in the "Parent category" section Aug 5, 2019

@khouloudbelguith

This comment has been minimized.

Copy link
Contributor

commented Aug 5, 2019

Hi @LimousinArcherie,

Thanks for these clarifications.
I manage to reproduce the issue with PS1.7.6.0.
In fact, a disabled category is not displayed in the "Parent category" section, which is not the same behavior as PS1.7.5.2.
https://drive.google.com/file/d/1tddbHs0rQgZmgtYYACKdOJ4rULrL2QcZ/view
I’ll add this to the debug roadmap so that it’s fixed. If you have already fixed it on your end or if you think you can do it, please do send us a pull request!
Thanks!

@marionf marionf added this to Backlog in PrestaShop 1.7.6 via automation Aug 5, 2019

@marionf marionf moved this from Backlog to To do in PrestaShop 1.7.6 Aug 5, 2019

@matthieu-rolland matthieu-rolland self-assigned this Aug 7, 2019

@matthieu-rolland matthieu-rolland moved this from To do to In progress in PrestaShop 1.7.6 Aug 7, 2019

@matthieu-rolland matthieu-rolland moved this from In progress to To be reviewed in PrestaShop 1.7.6 Aug 8, 2019

@marionf marionf moved this from To be reviewed to In progress in PrestaShop 1.7.6 Aug 9, 2019

@matks matks moved this from In progress to To be reviewed in PrestaShop 1.7.6 Aug 12, 2019

@matks matks moved this from To be reviewed to To be tested in PrestaShop 1.7.6 Aug 12, 2019

@marionf marionf moved this from To be tested to To be merged in PrestaShop 1.7.6 Aug 12, 2019

@marionf marionf added Fixed and removed To Do labels Aug 12, 2019

@marionf marionf added this to the 1.7.6.1 milestone Aug 12, 2019

@eternoendless

This comment has been minimized.

Copy link
Member

commented Aug 12, 2019

Closed via #15030

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.