-
- mbyrne

-
Total Posts: 1
Joined: 2010-10-09
|
When I needed to clear out all categories in Magento 1.7.0.2 I used the suggestions above but tweaked slightly. TRUNCATE was complaining about foreign key references so I just ran DELETE and then reset the AUTOINCREMENT so it started back at 3.
DELETE FROM `catalog_category_entity`; DELETE FROM `catalog_category_entity_datetime`; DELETE FROM `catalog_category_entity_decimal`; DELETE FROM `catalog_category_entity_int`; DELETE FROM `catalog_category_entity_text`; DELETE FROM `catalog_category_entity_varchar`; DELETE FROM `catalog_category_product`; DELETE FROM `catalog_category_product_index`;
insert into `catalog_category_entity`(`entity_id`,`entity_type_id`,`attribute_set_id`,`parent_id`,`created_at`,`updated_at`,`path`,`position`,`level`,`children_count`) values (1,3,0,0,NOW(),NOW(),'1',1,0,1),(2,3,3,0,NOW(),NOW(),'1/2',1,1,0); insert into `catalog_category_entity_int`(`value_id`,`entity_type_id`,`attribute_id`,`store_id`,`entity_id`,`value`) values (1,3,32,0,2,1),(2,3,32,1,2,1); insert into `catalog_category_entity_varchar`(`value_id`,`entity_type_id`,`attribute_id`,`store_id`,`entity_id`,`value`) values (1,3,31,0,1,'Root Catalog'),(2,3,33,0,1,'root-catalog'),(3,3,31,0,2,'Default Category'),(4,3,39,0,2,'PRODUCTS'),(5,3,33,0,2,'default-category');
ALTER TABLE catalog_category_entity AUTO_INCREMENT = 3;
Did the job for me. Hope it helps others.
|