ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Moving categories out of a group into a new group

August 27, 2011 11:00pm

Subscribe [3]
  • #1 / Aug 27, 2011 11:00pm

    Due to the limitations of the Channel Categories tag, as well as many other category plugins, I need to reconfigure how I have set up my categories.

    I need to move a category and its child categories out of the original category group. The parent category will become the category group and the child categories will become the categories.

    The issue is that I already have 230 entries categorized. And I have approx. 60 categories.

    If I delete the categories, will the entries become uncategorized? Will the category id be deleted? If not, the follow up question… Is there a way to delete the categories then add to the new group and assign the original category id?

    Thanks for any help in the matter.

  • #2 / Aug 29, 2011 3:16am

    John Henry Donovan

    12339 posts

    Hi Hendrik,

    If I delete the categories, will the entries become uncategorized?

    Yes they will. They will not revert to any default category. If the entry is assigned to a parent and a sub category then the parent assignment will still hold.

    Will the category id be deleted?

    It will be yest and if you create a new category after that it will start a new ID after the deleted category if it is the most recent and not just replace the category ID that was deleted.

    If you delete just the parent categories then it will not delete the sub categories and the entries will still be assigned to the sub categories if that helps? Although you are till left with the issue of dividing up those categories into groups. You will probably need to manipulate the data in the database to move some categories into the newer groups.

    Make sure you have a good backup before attempting anything

  • #3 / Sep 01, 2011 12:18pm

    Thanks. Just to be clear due to typos. The following is true When a category is deleted then the category id will be deleted.

    Can you explain the SQL table logic I might need to create to move categories into a newer group?

  • #4 / Sep 02, 2011 1:19pm

    Sue Crocker

    26054 posts

    Hi, Hendrik-Jan.

    If you look at the exp_category_posts table, you’ll see how categories are stored in that table.

    There are two fields, entry_id and cat_id.

    cat_id comes from the exp_categories table. I’m including two screen shots, one of a list of my category posts, and one from the exp_categories table.

    In these screen shots, you’ll see I have a category called Color, and subcategories called Red, Green, and Blue. On the last line of the exp_category_posts you’ll see reference to 5 and 8 in entry_id 14 - parent of Color and a child category of Blue.

    Does that make it any easier to understand?

  • #5 / Sep 02, 2011 1:26pm

    Yes that does. I believe from this, I can figure out how to update the tables in phpMyAdmin to avoid updating entries 1 by 1 in the CP. Most likely I will create the new category group and the new categories. Once I know the new cat_id, I can update the exp_category_posts table. find all the old cat_ids and update with the new value.

    thank you. Will try next week.

  • #6 / Sep 02, 2011 1:32pm

    Sue Crocker

    26054 posts

    Sounds good. Just make sure to backup your tables before attempting any sort of updating on your end. I’m going to go ahead and close the thread now, feel free to open a new thread based on this one if you run into any issues.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases