usermar Posted May 2, 2022 Share Posted May 2, 2022 Hi. I notice that when I create a new category it is not displayed correctly in the public part, it appears without breadcrumbs and without an apparent parent category. The cause is that the "nleft" and "nright" fields of the ps_category table always appear with value 0 and do not have a correct node value. All other fields such as the parent category etc are correct. I have done all kinds of tests but I can't figure out why the nodes are not generated. I have tried disabling most modules, switching to the default theme. I have also upgraded to version 1.7.8.5 in a test environment (I currently have 1.7.8.2 in production). I tried to call the Category::regenerateEntireNtree function to regenerate the categories. None of this seems to work. I would be very grateful if someone could help me or give me some hint. I have searched a lot and have not found any solution. Link to comment Share on other sites More sharing options...
Mian Waqas Posted May 11, 2022 Share Posted May 11, 2022 (edited) On 5/2/2022 at 8:54 PM, usermar said: Hi. I notice that when I create a new category it is not displayed correctly in the public part, it appears without breadcrumbs and without an apparent parent category. The cause is that the "nleft" and "nright" fields of the ps_category table always appear with value 0 and do not have a correct node value. All other fields such as the parent category etc are correct. I have done all kinds of tests but I can't figure out why the nodes are not generated. I have tried disabling most modules, switching to the default theme. I have also upgraded to version 1.7.8.5 in a test environment (I currently have 1.7.8.2 in production). I tried to call the Category::regenerateEntireNtree function to regenerate the categories. None of this seems to work. I would be very grateful if someone could help me or give me some hint. I have searched a lot and have not found any solution. Hi, i am really sorry for the issue you are facing, but Please can you share some screenshots of front office & backoffice category part? your question seems to be very confusy or not related to what you are talking about, that is why there is no reply since 10 days. Regards Edited May 11, 2022 by SMTmardan (see edit history) Link to comment Share on other sites More sharing options...
usermar Posted May 18, 2022 Author Share Posted May 18, 2022 Thank you very much for your reply, sorry for the delay. I will try to explain the problem in a simpler and clearer way. In the ps_category table of the BBDD each category has a value "nleft" and "nright". This value is auto-calculated every time any category or subcategory is added, removed or moved (I don't know exactly how the calculation is done). Apparently, Prestashop uses these values to position the category within the tree of categories and subcategories. My problem is that no matter what I do, since some time ago, any operation with categories gives as value nleft=0 and nright=0. This generates errors and problems in the Front Office part, for example in breadcrumbs or SEO. Any help to find out the cause would be welcome, it's very frustrating. Link to comment Share on other sites More sharing options...
Mian Waqas Posted May 18, 2022 Share Posted May 18, 2022 Hi, Did you tried these suggestions? In Back office, I believe add/delete a category or (temporarily) move a category under a new parent and then save it will rebuild the tree structure. (maybe make a category 'tempcat' and put it under any parent. Then save the category. Check if the left and right values are added in the database. Then delete the tempcat afterwards) Link to comment Share on other sites More sharing options...
usermar Posted May 18, 2022 Author Share Posted May 18, 2022 Thank you very much for your reply, Yes, I have tried everything. Every new category I create has "0" values and if I move this category it still has "0"values. But not only that, whatever I do it doesn't change the values of the rest of the categories. Even if I delete this or another category all the values of the others categories never change. Link to comment Share on other sites More sharing options...
Mian Waqas Posted May 18, 2022 Share Posted May 18, 2022 A question, had you migrated the data from another store? Also when you enable debug mode, and try to create, or move a acategory , are there any errors showing? Regards Link to comment Share on other sites More sharing options...
thisisfine Posted June 3, 2022 Share Posted June 3, 2022 On 5/2/2022 at 5:54 PM, usermar said: the "nleft" and "nright" fields of the ps_category table always appear with value 0 and do not have a correct node value. I am struggling with the same problem. After adding categories from the dash, I have to change manually in the database the values of "nleft" and "nright" fields. Has anyone dealt with this problem? PS v 1.6.1.0 Link to comment Share on other sites More sharing options...
musicmaster Posted June 3, 2022 Share Posted June 3, 2022 The most logical explanation is that there is somewhere a php error that stops the code before it can set nleft/nright. But as most of the action happens in ajax calls it is quite hard to find out. Looking in the error log of the server is often the easiest way. Prestools has a function to restore the nleft/nright tree (it is in the Integrity Checks). 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