bibob Posted May 25, 2016 Share Posted May 25, 2016 Hello is there any way to bulk delete empty categories by a query from the database? Link to comment Share on other sites More sharing options...
bibob Posted May 25, 2016 Author Share Posted May 25, 2016 Found a solution DELETE FROM`ps_category` WHERE `id_category` != 1 and id_category not in (SELECT cp.id_category from ps_category_product cp ) ; DELETE FROM `ps_category_lang` where id_category not in (select id_category from ps_category);DELETE FROM `ps_category_group` where id_category not in (select id_category from ps_category);DELETE FROM `ps_category_shop` where id_category not in (select id_category from ps_category); 1 1 Link to comment Share on other sites More sharing options...
pedash1 Posted November 5, 2016 Share Posted November 5, 2016 This is excellent Was successful Thankful Found a solution DELETE FROM`ps_category` WHERE `id_category` != 1 and id_category not in (SELECT cp.id_category from ps_category_product cp ) ; DELETE FROM `ps_category_lang` where id_category not in (select id_category from ps_category);DELETE FROM `ps_category_group` where id_category not in (select id_category from ps_category);DELETE FROM `ps_category_shop` where id_category not in (select id_category from ps_category); Link to comment Share on other sites More sharing options...
oleksandr Posted September 9, 2018 Share Posted September 9, 2018 Удаление пустых категорий. Что были созданы при тестировании загрузчика, работает, спасибо. да можно было в ручную, но долго ! Link to comment Share on other sites More sharing options...
Gipielle Posted April 20, 2020 Share Posted April 20, 2020 Hello, this query is for all prestashop versions ? Link to comment Share on other sites More sharing options...
jmauclair Posted May 19, 2021 Share Posted May 19, 2021 (edited) On 4/21/2020 at 12:11 AM, Gipielle said: Hello, this query is for all prestashop versions ? I ps 1.7 replace ps_ by miib_ DELETE FROM`miib_category` WHERE `id_category` != 1 and id_category not in (SELECT cp.id_category from miib_category_product cp ) ; DELETE FROM `miib_category_lang` where id_category not in (select id_category from miib_category); DELETE FROM `miib_category_group` where id_category not in (select id_category from miib_category); DELETE FROM `miib_category_shop` where id_category not in (select id_category from miib_category); Edited July 4, 2021 by jmauclair (see edit history) 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now