Delete all child categories but not the parent categories

  • Posts: 74
  • Thank you received: 5
  • Hikashop Business
4 weeks 7 hours ago #310194

-- HikaShop version -- : 4.2.1
-- Joomla version -- : 3.9.11
-- PHP version -- : 7.2.21
-- Browser(s) name and version -- : opera
-- Error-message(debug-mod must be tuned on) -- : not an error

Hi,
Is there an easy way to delete all sub-categories without deleting the parent categories. Our parent categories have graphics set up and don't change. However our site is large and the subcategories change a lot and frequently.

At the moment we do this manually which takes a long time. I did notice that there was a 'category_level_' parameter in mass actions but couldn't get it to work.

Thanks,
Ian and Stu

Please Log in or Create an account to join the conversation.

  • Posts: 12136
  • Thank you received: 1673
  • MODERATOR
3 weeks 6 days ago #310199

Hello,

Using that kind of mass actions (cf attached screenshot) will probably do the job, and for more information :
www.hikashop.com/support/documentation/167-massaction-form.html

Where category_parent_id is the ID of the category in which you want to delete child categories.

We wish you a nice day!
Kind regards,
Mohamed Thelji

Attachments:
Last edit: 4 weeks 1 hour ago by Mohamed Thelji.

Please Log in or Create an account to join the conversation.

  • Posts: 74
  • Thank you received: 5
  • Hikashop Business
1 week 6 days ago #310690

Hi,
your solution work but only for one parent category. I tried to add another entry and, although it recognised that there were child categories, it didn't seem to delete them properly. When I went back to the 'Categories' menu they were still there. Rebuilding the menu tree didn't help.

Should I be using some sort of logical and/or in the one line or maybe putting in the parent ids as a list?

Thanks,
Ian

p.s. In 'mass actions' the addition entries register as '0' (i.e. being deleted) but, as mentioned above, still appear in the 'category' menu. So it might be a database thing.

Please Log in or Create an account to join the conversation.

  • Posts: 12136
  • Thank you received: 1673
  • MODERATOR
1 week 5 days ago #310699

Hello,

There's actually no logical "OR" filter for mass actions, only "AND".

So the solution will probably be to create one mass action per category to manage.

So it might be a database thing.

Yes, it is because it will only check in your database, categories which have that ID as a category_parent_id, so it won't enable you to manage child categories.

The solution will be to either create a mass action per category, or directly develop a script which will do it.

Kind regards,
Mohamed Thelji.

Please Log in or Create an account to join the conversation.

  • Posts: 74
  • Thank you received: 5
  • Hikashop Business
1 week 5 days ago #310732

Thanks,
it was ok deleting all of the children in the first parent. But other parent categories didn't work in the same mass action. As you say I may need one for each but running about fifty of them individually is slower than manually so we'll stick to that unfortuately.

ian and stu

Please Log in or Create an account to join the conversation.

Time to create page: 0.058 seconds
Powered by Kunena Forum