3

What's the best way to move a large number of categories?

For example moving a level 2 category and all its children to being a level 1 category with level 2 children:

Level 1
- Level 2
-- Level 3
-- Level 3
-- Level 3
-- Level 3

I've already attempted this before by drag/dropping the category within magento admin panel, this caused a number of problems:

1) 1000's of system rewrites were created. 2) Search results, related products and a custom module similar to related products all stopped working.

It ended up with db having to be rolled back pre movement.

1 Answer 1

1

For anybody needing help with this, my problem appeared to be that Magento drag and drop didn't like when I moved a new Level 1 category between two existing Level 1 categories, to achieve the desired navigation the path I took is below.

1) Empty the categories you want to move of all products.
2) Create a new main level category but do not position.
3) Move all empty sub categories under the newly created main category.
4) Re-populate empty categories with original product data.
5) Access you sites database and open table catalog_category_entity

Within that table you can see all categories. The fields we are interested in are position and path.

So a single value within path such a "1" denotes the root magento category.

Two values separated by a "/" such as "1/2" in this instance refers to magentos "Default Category".

I place all my required categories as sub-categories of the default category. So my Level 1 categories will appear with the path "x/x/x". For example 1/2/4, where

1 = magento root category
2 = magento default category
4 = ID of my Level 1 category

So if I want to reposition Level 1 categories without using the magento drag and drop I can change the position field values (Column to the right of path in database) for my level 1 categories.

For example:

path             position

1/2/4            1
1/2/5            5
1/2/6            2
1/2/7            4
1/2/8            3

I know this appears quite complex, if anybody has any problems or questions please ask away.

Also i'd like to note that I do not recommend you alter database values directly unless you know what your doing and is a last resort. This solution only came about after 3 database rollbacks whilst trying to find a solution within magento.

Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.