1

I have a category group in ee3 with 100+ categories that were imported. Is there a way I can get them to be sorted alpha without drag & drop manually in the control panel?

0

I'm sure this will be added to ee3 at some point, but you can work directly in the database to do this. (Tested on mysql 5.6.34, ee 3.5.4, backup first!)

-- set the user variable
SET @cat_order_val = 0;

-- reorder the cat_order column based on Category Url Title (alpha ascending)
UPDATE exp_categories 
    SET cat_order = (@cat_order_val := @cat_order_val + 1) 
    WHERE group_id = 1 
    ORDER BY cat_url_title ASC;

edit: added group_id condition, change to match your group id.

2
  • Thanks. That'll have to do for now. I just added the group_id and changed to sort by cat_name instead of url_title (not sure if the client changed any of those in the old site). Hopefully this gets into ee3 soon – koivi Apr 13 '17 at 19:42
  • Great.. Yes forgot group_id, so updated the example for future ref. – Romans-8---31-39 Apr 13 '17 at 20:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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