Designinfo.in Posted October 2, 2015 Share Posted October 2, 2015 nleft and nright values for new categories are 0 . They are not getting updated. the new categories that i create are not visible in the front office in the screenshit you will be able to see the last 4 categories have 0 nleft and nright values .htaccess file has not been changes images for other categories not visible in top horizontal menu rest all categories work fine these new categories are set to be enabled obviously i want to regenerate the category tree---prestashop is not doing it automatically for me Link to comment Share on other sites More sharing options...
NemoPS Posted October 2, 2015 Share Posted October 2, 2015 I'd try adding Category::regenerateEntireNtree();Use it inside any module that hooks anywhere, as long as it runs 3 Link to comment Share on other sites More sharing options...
Designinfo.in Posted October 2, 2015 Author Share Posted October 2, 2015 What do u mean add in any module....? Sorry did not understand Do you mean I should add it in the top Horizontal menu css files? Please be a little more specific Link to comment Share on other sites More sharing options...
musicmaster Posted October 2, 2015 Share Posted October 2, 2015 Nemo means that the important thing is that you run it. Of course you cannot run php from a css file. You need to call the function from a php file. 1 Link to comment Share on other sites More sharing options...
Designinfo.in Posted October 2, 2015 Author Share Posted October 2, 2015 how to call this function? I dont know how to do it. Link to comment Share on other sites More sharing options...
musicmaster Posted October 2, 2015 Share Posted October 2, 2015 What Prestashop version are you using? Link to comment Share on other sites More sharing options...
NemoPS Posted October 3, 2015 Share Posted October 3, 2015 Just drop this inCategory::regenerateEntireNtree(); Link to comment Share on other sites More sharing options...
Designinfo.in Posted October 8, 2015 Author Share Posted October 8, 2015 Just drop this in Category::regenerateEntireNtree(); What do you mean ? In which file does this code have to added and in which lines? Please advise. This has been an issue for me now. Link to comment Share on other sites More sharing options...
NemoPS Posted October 9, 2015 Share Posted October 9, 2015 Just grab any active module, any active hook, and paste it there. It just has to run. Link to comment Share on other sites More sharing options...
Kogkalidis Posted October 9, 2016 Share Posted October 9, 2016 I'd try adding Category::regenerateEntireNtree(); Use it inside any module that hooks anywhere, as long as it runs Thanx NemoPS, you saved my life. Cheers Link to comment Share on other sites More sharing options...
kulk21 Posted February 9, 2017 Share Posted February 9, 2017 Category::regenerateEntireNtree(); do i drop this from backofice or from ftp server not sure what to do? 1 Link to comment Share on other sites More sharing options...
kevinberben Posted October 30, 2017 Share Posted October 30, 2017 Hi all, I use this : Db::getInstance()->execute('UPDATE `ps_category` SET `nleft`=0,`nright`=0 WHERE 1'); Category::regenerateEntireNtree(); Now each nleft and Nrights are on 0. But the catagory regeneration does not work. I try to use the Regenerate Category Tree module. When I regenerate, it does not work too. Maybe a problem in my pq_category table? Can someone help me? Thanks, Kev Link to comment Share on other sites More sharing options...
NemoPS Posted November 1, 2017 Share Posted November 1, 2017 It might as well be, the only way to know is troubleshooting line by line Link to comment Share on other sites More sharing options...
Blue Bear Posted March 15, 2021 Share Posted March 15, 2021 Hi everyone, I need to regenerate the category tree of my prestashop 1.7.5.1.0. I don't know where to apply any of this solutions : Db::getInstance()->execute('UPDATE `ps_category` SET `nleft`=0,`nright`=0 WHERE 1'); Category::regenerateEntireNtree(); or Category::regenerateEntireNtree(); Can someone could be more specific or share an example of modifiefd file in order for me to understand please ? And is it still working for prestashop 1.7.5.1.0 ? I've tried to load the category tree module https://github.com/johnulist/category-tree-regenerator and it's not working. Best regards, Clément Link to comment Share on other sites More sharing options...
musicmaster Posted March 18, 2021 Share Posted March 18, 2021 On 3/15/2021 at 11:03 AM, Blue Bear said: Hi everyone, I need to regenerate the category tree of my prestashop 1.7.5.1.0. I don't know where to apply any of this solutions : Db::getInstance()->execute('UPDATE `ps_category` SET `nleft`=0,`nright`=0 WHERE 1'); Category::regenerateEntireNtree(); or Category::regenerateEntireNtree(); Can someone could be more specific or share an example of modifiefd file in order for me to understand please ? And is it still working for prestashop 1.7.5.1.0 ? I've tried to load the category tree module https://github.com/johnulist/category-tree-regenerator and it's not working. Best regards, Clément I have no idea why nleft and nright are set to zero first. Seems just foolish to me. Note that when you regenerate it recreates the tree from the information it finds in id_parent, is_root, position and level. So when there is a problem with those values regeneration won't work. Prestools has some kind of regeneration function too in its Integrity Checks. Link to comment Share on other sites More sharing options...
David MEYER Posted February 7, 2023 Share Posted February 7, 2023 On 3/18/2021 at 7:43 PM, musicmaster said: I have no idea why nleft and nright are set to zero first. Seems just foolish to me. Because if a category is orphaned, it will not be modified by regenerateEntireNtree() and will keep his nright and nleft which will be in conflict with good ones. Link to comment Share on other sites More sharing options...
PatriceJV Posted October 19, 2023 Share Posted October 19, 2023 The problem I had was that I needed to be logged to be able to run the function. Here is my file that I can fire even if I'm not logged in the admin Echo "Whatever pleases you to print on the page when it is done"; //Indicate where to find you config file require 'Your_Path_To_This_File/config/config.inc.php'; //Set all nleft and nright to zero prior to generate Db::getInstance()->execute('UPDATE `ps_category` SET `nleft`=0,`nright`=0 WHERE 1'); //Then regenerate Category::regenerateEntireNtree(); 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