Jump to content

[Solved] Adding new category programaticaly


lozaria

Recommended Posts

Hi,

I'm working on a free app that should be able to add new categories.
I'm investigating the ps_category table. I know that level_depth, nleft and nright fields are used for quicker building of the nested hierarchy structure of the Categories. However when adding new category with blank level_depth, nleft and nright it is still visible inside the Categories Block and inside BackOffice.

My question is - are level_depth, nleft and nright in Category table required and used at all?

Many thanks!

Link to comment
Share on other sites

Hi;
level_depth used in getCategories(..... $order = true ... ) for ordinating. So its important for a lot of modules/functions use it.

nleft and nright is required too. Eg: its used in breadcrumb, navigation etc. But i advice that
you can ınsert as blank/Null them while adding a new row.
than execute

Category::regenerateEntireNtree()



This function Re-calculates the values of all branches of the nested tree for all categories. Than updates them less than a second.

regards

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...