3

In our EE1 installation we have the preference "Auto-Assign Category Parents" set to "No".

Now I am faced with a situation where for once particular set of categories it would be very useful to have this as "Yes" but It still probably makes sense for it to be "No" system-wide tho so we are still leaving it off as I don't believe there's any way to have it work just for one set of categories.

My question is this... Is there any way to "automatically" apply the parent category to all the entries that already have this particular subset of categories that I am interested in?

I see an EE2 answer here...

Automatically assign parent category to sub-category entries?

But I am in EE1.

I started to look at this in MySQL...

This query gives me all the entries that I would like have the parent category:

select distinct
    (t.entry_id)
from
    exp_weblog_titles t
        left join
    exp_category_posts cp ON t.entry_id = cp.entry_id
        left join
    exp_categories c ON c.cat_id = cp.cat_id
where
    t.weblog_id = 5 and c.parent_id = 4810
order by entry_id
limit 100000

But what if some of them already the parent category assigned? I don't want to categorize them twice. I think I need to use something like:

INSERT INTO exp_category_posts ...  
WHERE NOT EXISTS 
    (SELECT * 
    from exp_category_posts 
    where cat_id =  4810 and entry_id = ?this_entry_id?)

but the syntax is a little beyond me.

Since I framed this as primarily a mySQL question I've cross-posted it to SO casting the question a little bit differently.

1 Answer 1

2

Depending how many entries need updating you can always bulk assign a category to multiple entries from the main edit page.

3
  • Don't believe there's an interface to do this in EE1.
    – AllInOne
    Nov 10, 2013 at 20:45
  • 1
    Believe it..;) Select multiple entries, bottom of the Edit tab, select "Add categories". Nov 25, 2013 at 13:05
  • Wow, thanks can't believe I never saw that before. Not practical solution here tho. I did it in MySQL as described in the linked SO page. Thanks tho!
    – AllInOne
    Dec 12, 2013 at 19:36

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.