Removing products and categories from the database
This is an old revision of the document!
=====Update to Removing products through the database=====
Ive used the following to remove all product records and related data from the mySQL tables.
- TRUNCATE TABLE `cataloginventory_stock_item`;
- TRUNCATE TABLE `catalogindex_minimal_price`;
- TRUNCATE TABLE `catalog_product_entity`;
- TRUNCATE TABLE `catalog_product_entity_datetime`;
- TRUNCATE TABLE `catalog_product_entity_decimal`;
- TRUNCATE TABLE `catalog_product_entity_int`;
- TRUNCATE TABLE `catalog_product_entity_text`;
- TRUNCATE TABLE `catalog_product_entity_varchar`;
- TRUNCATE TABLE `catalog_category_product`;
- TRUNCATE TABLE `catalog_category_product_index`;
- TRUNCATE TABLE `catalog_compare_item`;
- TRUNCATE TABLE `catalog_product_bundle_option`;
- TRUNCATE TABLE `catalog_product_bundle_option_value`;
- TRUNCATE TABLE `catalog_product_bundle_selection`;
- TRUNCATE TABLE `catalog_product_enabled_index`;
- TRUNCATE TABLE `catalog_product_entity`;
- TRUNCATE TABLE `catalog_product_entity_gallery`;
- TRUNCATE TABLE `catalog_product_entity_media_gallery`;
- TRUNCATE TABLE `catalog_product_entity_media_gallery_value`;
- TRUNCATE TABLE `catalog_product_entity_tier_price`;
- TRUNCATE TABLE `catalog_product_link`;
- TRUNCATE TABLE `catalog_product_link_attribute`;
- TRUNCATE TABLE `catalog_product_link_attribute_int`;
- TRUNCATE TABLE `catalog_product_website`;
- TRUNCATE TABLE `catalog_compare_item`;
Note: Tested this also by re-importing data back into tables. Worked fine
Removing products through the database |
This should remove all the products and their related records.
- TRUNCATE TABLE `catalog_product_entity`;
Removing categories requires bit more actions.
- TRUNCATE TABLE `catalog_category_entity`;
- DELETE FROM `catalog_category_tree` WHERE `entity_id`<>1;
After that you will have to create root categories for your stores and assign them to stores in configuration:
admin menu / system / configuration / catalog - choose a store, choose Root Category.


