简体   繁体   中英

xt:Commerce nested set categories_left and categories_right

A long time ago, I built an importer for xt:Commerce that worked fine up to v4.1. The data came from the same PIM system as before.

But now, v4.2.0 is out, and they've added a nested set for the categories. Anyways that's ok, but they've added two new columns called categories_left and categories_right - and they mess up my importer.

First of all, I really don't understand what those columns are for. My importer works and puts all stuff correctly in the database, but in the frontend, the cats style is broken. The cause is that my importer sets all cats in those two columns to 0.

If I add the cats in the backend, it works fine and the frontend style is working. It seems that these columns are incrementing themselves by 2.

categories_id   categories_left   categories_right   parent_id
1               1                 2                  0
2               3                 4                  1
3               5                 6                  1
4               7                 8                  1
5               9                 10                 1

So I implemented a func in the importer that will do exactly the same shown above. On the homepage, the frontend style is fine, but if I click on a category the style is broken again.

Could anyone explain what these two columns are for, and how to get this fixed, please?

Solution:

Got the answer by myself and built a function that loops through the whole cats. This helped me a lot: nested set "Raupe" , full documentation here: wolkekraft Nested Set (german)

If it is only a manual/one time import, you can leave the columns categories_left and categories_right empty. After the import add a dummy-category in the administration backend. When the new category is saved, all categories_left/right columns are recalculated and saved to the database.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM