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.

batch categories puzzle

December 21, 2011 4:42pm

Subscribe [2]
  • #1 / Dec 21, 2011 4:42pm

    thefifthlion

    133 posts

    I’ve received a little guidance on how to use phpMyAdmin to batch import my categories:

    0. backup database
    1. export categories table as a .csv file
    2. use the same cell structure to setup a batch of categories in excel
    3. export back out to .csv with variables enclosed in double quotes
    4. the categories show up the EE2 control panel Admin>Channel Entries>Categories view

    5. but the categories added through phpMyAdmin don’t show up when using EE tags like the following?

    {exp:channel:categories channel="profile"}
        {category_name}
    {/exp:channel:categories}

    So the categories look like they’ve been added successfully but they aren’t accessible via tags? Only the categories added manually through the control panel show up? Any ideas on what I could be leaving out of the equation. THIS IS KILLING ME!

  • #2 / Dec 22, 2011 7:49am

    Boyink!

    5011 posts

    I’m thinking if they don’t show up in tag results, they really haven’t been successfully added…;)

    I know when importing channel entries several tables need to be updated and am thinking that might be the case here.

    Were it me I’d turn on the output profiler, display SQL queries, and watch watch queries EE generates when adding a category via the Control Panel.

    Or see if I could find the source code file for the categories tag pair and puzzle out what SQL statement it’s using to return the list of categories.

  • #3 / Dec 22, 2011 10:16am

    thefifthlion

    133 posts

    Thanks for the reply, especially so close to Christmas.

    Can you elaborate on having to update multiple tables? That could be my problem. I’m simply importing to the exp_categories table. I thought that would take care of everything?

  • #4 / Dec 22, 2011 10:26am

    Boyink!

    5011 posts

    I don’t really know what else there is to say - EE runs on database where sometimes data is split across multiple tables and connected with database keys.  You can’t make assumptions about how to back-feed data in without a closer look at the data model, which is done by the methods I’ve already suggested.

  • #5 / Dec 22, 2011 10:51am

    thefifthlion

    133 posts

    Thanks for your guidance. I’ve noticed that there is another table titled exp_category_posts and it only has the posts I added via the control panel. Seems like the culprit.

    happy holidays

  • #6 / Dec 22, 2011 3:09pm

    Dan Decker

    7338 posts

    Hi thefifthlion,

    First, let me say, I love seeing our users being resourceful! I will have to note that this method is not at all supported, unfortunately. Boyink! seems to have you on the right path, Since you are in PHPMyAdmin, take note of any tables that have exp_categories_* in the name. At this point, it looks like you are leaving out exp_category_groups. In the end, this may end up being more work than adding the Categories through the Control Panel.

    I’m moving this thread over to Community Help to keep the discussion going.

    Cheers!

  • #7 / Dec 22, 2011 9:33pm

    thefifthlion

    133 posts

    Dan,

    I’ve used the import method via PHPmyAdmin to update both the exp_categories table as well as the exp_category_data table and everything works great! I had to update both.

    I’m wondering what others would do given my situation. I have an entire State’s worth of counties and associated towns/cities. A very long list. So I decided to use the method described above to setup categories through the database.

    Then I got to thinking that I might be able to do this alternatively with a custom field that contained a series of checkboxes. Which do you suppose the average EE developer would choose to do?

    The only problem I see with the custom field approach is that I won’t have the ability to have the user select a paticular “county” parent group that instantly selects all its coordinating cities.

    Any suggestions for a student of EE?

  • #8 / Dec 23, 2011 7:44am

    Boyink!

    5011 posts

    You haven’t described much about the desired outcome, but so far categories sound like the proper choice.

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

ExpressionEngine News!

#eecms, #events, #releases