- Posts: 28
- Thank you received: 0
Database nested set model problems in category tab
10 years 8 months ago - 10 years 8 months ago #226623
by Cedwyn
Database nested set model problems in category tab was created by Cedwyn
-- HikaShop version -- : latest
Backend: "Check Database" returns "ok". "Rebuild" category doesn't fix this.
Under __hikashop_category, several categories are set to 0 for category_left and _right.
There are also a number of categories that display at the root tree even though their parent is set correctly.
A category is set up with a category_order of 2 of 4 but has a left/right value indicating that it is placed last in the tree:
Category / Order / Left / Right
Cat A / 1 / 100 / 101
Cat B* / 2 / 106 / 107
Cat C / 3 / 102 / 103
Cat D / 4 / 104 / 105
So in the above example, Category B is ordered 2nd but has a left/right nest that places it at the end of the model structure.
SO: I am hoping I can do something like deleting the left/right values in the database, then hitting rebuild on the backend ui and have the database fix itself. Or perhaps you have a script that will do this for me - I can just make one, but figured I'd ask first.
Thanks
Backend: "Check Database" returns "ok". "Rebuild" category doesn't fix this.
Under __hikashop_category, several categories are set to 0 for category_left and _right.
There are also a number of categories that display at the root tree even though their parent is set correctly.
A category is set up with a category_order of 2 of 4 but has a left/right value indicating that it is placed last in the tree:
Category / Order / Left / Right
Cat A / 1 / 100 / 101
Cat B* / 2 / 106 / 107
Cat C / 3 / 102 / 103
Cat D / 4 / 104 / 105
So in the above example, Category B is ordered 2nd but has a left/right nest that places it at the end of the model structure.
SO: I am hoping I can do something like deleting the left/right values in the database, then hitting rebuild on the backend ui and have the database fix itself. Or perhaps you have a script that will do this for me - I can just make one, but figured I'd ask first.
Thanks
Last edit: 10 years 8 months ago by Cedwyn.
Please Log in or Create an account to join the conversation.
10 years 8 months ago #226673
by nicolas
Replied by nicolas on topic Database nested set model problems in category tab
Hi,
The rebuild button will indeed set back the left/right automatically.
If some of the categories left and right are set to 0, it likely means that these categories are not reachable from the main category tree.
Check their category_parent_id. It must be set with the id of a category of the tree. The rebuild system bases itself on that to reset the left/right automatically.
The rebuild button will indeed set back the left/right automatically.
If some of the categories left and right are set to 0, it likely means that these categories are not reachable from the main category tree.
Check their category_parent_id. It must be set with the id of a category of the tree. The rebuild system bases itself on that to reset the left/right automatically.
Please Log in or Create an account to join the conversation.
Time to create page: 0.138 seconds