Tuesday, November 18, 2014

Magento - Category Reset

So I have a magento install that needed to be cleared out. One of the problems is resetting the categories back to zero.  The issue is that the admin area uses these categories also.

Solution: Don't delete the #1 entity_id.

MySQL Queries...
DELETE FROM catalog_category_entity where entity_id <> 1;
ALTER TABLE catalog_category_entity AUTO_INCREMENT = 2;

DELETE FROM catalog_category_entity_datetime where entity_id <> 1;
ALTER TABLE catalog_category_entity_datetime AUTO_INCREMENT = 2;

DELETE FROM catalog_category_entity_decimal where entity_id <> 1;
ALTER TABLE catalog_category_entity_decimal AUTO_INCREMENT = 2;

DELETE FROM catalog_category_entity_int where entity_id <> 1;
ALTER TABLE catalog_category_entity_int AUTO_INCREMENT = 2;

DELETE FROM catalog_category_entity_text where entity_id <> 1;
ALTER TABLE catalog_category_entity_text AUTO_INCREMENT = 2;

DELETE FROM catalog_category_entity_varchar where entity_id <> 1;
ALTER TABLE catalog_category_entity_varchar AUTO_INCREMENT = 2;