[Skip to main content](#vessel-content)

#   Delete all child categories but not the parent categories

##

- **[smithshop123](/forum/user/17903-smithshop123 "View smithshop123's Profile")**
- [![smithshop123's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/17903-smithshop123 "View smithshop123's Profile") Topic Author
- [ Offline](/forum/user/17903-smithshop123)

Less More

- Posts: 212
- Thank you received: 17
-
-

7 years 2 months ago [\#310194](#310194) by [smithshop123](/forum/user/17903-smithshop123 "View smithshop123's Profile")  *[Delete all child categories but not the parent categories](/forum/44-mass-actions/898157-delete-all-child-categories-but-not-the-parent-categories#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&#95;level&#95;' parameter in mass actions but couldn't get it to work.  Thanks, Ian and Stu")* was created by *[smithshop123](/forum/user/17903-smithshop123 "View smithshop123's Profile")*

-- 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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL21hc3MtYWN0aW9ucy84OTgxNTctZGVsZXRlLWFsbC1jaGlsZC1jYXRlZ29yaWVzLWJ1dC1ub3QtdGhlLXBhcmVudC1jYXRlZ29yaWVzP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")**
- [![Mohamed Thelji's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6861.png)](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")
- [ Offline](/forum/user/6861-mohamed-thelji)

Less More

- Posts: 12953
- Thank you received: 1778
-
-
-

7 years 2 months ago -  7 years 2 months ago [\#310199](#310199) by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")  Replied by *[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")* on topic *[Delete all child categories but not the parent categories](/forum/44-mass-actions/898157-delete-all-child-categories-but-not-the-parent-categories#310199 "-- 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&#95;level&#95;' parameter in mass actions but couldn't get it to work.  Thanks, Ian and Stu")*

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](https://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

- [ ![Joomla3-Administration-Massactions-GoogleChrome2019-08-2609.32.56.png](/forum/attachment/47527) ](/forum/attachment/47527 "...2609.32.56.png") [ ](/forum/attachment/47527?download=1 "...2609.32.56.png")

Last edit: 7 years 2 months ago by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL21hc3MtYWN0aW9ucy84OTgxNTctZGVsZXRlLWFsbC1jaGlsZC1jYXRlZ29yaWVzLWJ1dC1ub3QtdGhlLXBhcmVudC1jYXRlZ29yaWVzP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[smithshop123](/forum/user/17903-smithshop123 "View smithshop123's Profile")**
- [![smithshop123's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/17903-smithshop123 "View smithshop123's Profile") Topic Author
- [ Offline](/forum/user/17903-smithshop123)

Less More

- Posts: 212
- Thank you received: 17
-
-

7 years 1 month ago [\#310690](#310690) by [smithshop123](/forum/user/17903-smithshop123 "View smithshop123's Profile")  Replied by *[smithshop123](/forum/user/17903-smithshop123 "View smithshop123's Profile")* on topic *[Delete all child categories but not the parent categories](/forum/44-mass-actions/898157-delete-all-child-categories-but-not-the-parent-categories#310690 "-- 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&#95;level&#95;' parameter in mass actions but couldn't get it to work.  Thanks, Ian and Stu")*

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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL21hc3MtYWN0aW9ucy84OTgxNTctZGVsZXRlLWFsbC1jaGlsZC1jYXRlZ29yaWVzLWJ1dC1ub3QtdGhlLXBhcmVudC1jYXRlZ29yaWVzP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")**
- [![Mohamed Thelji's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6861.png)](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")
- [ Offline](/forum/user/6861-mohamed-thelji)

Less More

- Posts: 12953
- Thank you received: 1778
-
-
-

7 years 1 month ago [\#310699](#310699) by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")  Replied by *[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")* on topic *[Delete all child categories but not the parent categories](/forum/44-mass-actions/898157-delete-all-child-categories-but-not-the-parent-categories#310699 "-- 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&#95;level&#95;' parameter in mass actions but couldn't get it to work.  Thanks, Ian and Stu")*

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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL21hc3MtYWN0aW9ucy84OTgxNTctZGVsZXRlLWFsbC1jaGlsZC1jYXRlZ29yaWVzLWJ1dC1ub3QtdGhlLXBhcmVudC1jYXRlZ29yaWVzP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[smithshop123](/forum/user/17903-smithshop123 "View smithshop123's Profile")**
- [![smithshop123's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/17903-smithshop123 "View smithshop123's Profile") Topic Author
- [ Offline](/forum/user/17903-smithshop123)

Less More

- Posts: 212
- Thank you received: 17
-
-

7 years 1 month ago [\#310732](#310732) by [smithshop123](/forum/user/17903-smithshop123 "View smithshop123's Profile")  Replied by *[smithshop123](/forum/user/17903-smithshop123 "View smithshop123's Profile")* on topic *[Delete all child categories but not the parent categories](/forum/44-mass-actions/898157-delete-all-child-categories-but-not-the-parent-categories#310732 "-- 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&#95;level&#95;' parameter in mass actions but couldn't get it to work.  Thanks, Ian and Stu")*

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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL21hc3MtYWN0aW9ucy84OTgxNTctZGVsZXRlLWFsbC1jaGlsZC1jYXRlZ29yaWVzLWJ1dC1ub3QtdGhlLXBhcmVudC1jYXRlZ29yaWVzP3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.106 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
