Jump to content

what is the php code 1.4 category nleft nright?


Recommended Posts

Got the same Issue. Database get automatically updated and nothing gets entered into those fields. When you go into phpmyadmin, all nleft and nright are zero. But when you, in the admin panel, add a new category, everything will be updated.

Is there a way to update the field automatically?

Link to comment
Share on other sites

Breadcrumbs weren't working and it took me ages to figure out, but thanks to my colleague I found a solution.

There's a function in the Class Category called regenerateEntireNtree(). In his script, that automatically fills the prestashop database with items he added the following code to get the database updated again:

 
include(dirname(__FILE__).'/config/config.inc.php');
Category::regenerateEntireNtree();

  • Like 3
Link to comment
Share on other sites

Thanks for your replay,

Firstly, i write these codes to my php file. But it didn't regenerate.
When i create a new php file only that two rows. it did.

Do you have any idea why not work from my php file ( i put this row : include(dirname(__FILE__).'/config/config.inc.php'); top of page and this row bottom. ) .My file not give any mistakes and looks like it done. But when i control the database there are no changes.

Link to comment
Share on other sites

Is your file in the right directory? you can change the include to
include('/var/www/prestashopfolder/config/config.inc.php'); // absolute path


or

include('../shop/config/config.inc.php'); // relative path



include('../../config/config.inc.php'); Two file i use the same path. if i use regenerate.php ıts ok. But i want to add my categoryadd.php file.
Link to comment
Share on other sites

  • 3 weeks later...
  • 1 year later...

Alex, your link gives a 404, thanks for a kick that lead me to a workaround, though..

 

I also experienced issues with categories and redirect loops recently. I am trying to get a multishop to work, which is not easy at all. When I added a new category, it gave me a redirect loop. The other categories created earlier worked fine, which is strange. My PS is v1.5.3 and it was upgraded from 1.3.6.

 

I tried running the method as Andrex84 suggested above, but it didn't work for me. So I went to my database again and I could see that the values in nleft and nright are in a row in the "old" categories, that worked fine. The couples for nleft and nright in my case are always (1, 2), (3, 4), (5, 6), (7, 8) if the categories don't have any subcategories.

 

The workaround that worked for me was that I simply inserted the next couple in the nleft and nright columns, which in my case was (31, 32), (33, 34) and the categories work fine now!

 

I am aware that this can possibly cause issues in the future, but I don't have any other solution right now.. I didn't find any other way how to force the program to rebuild the categories tree so far..

Link to comment
Share on other sites

  • 3 months later...
×
×
  • Create New...