insert into `catalog_product_link_type`(`link_type_id`,`code`) values (1,'relation'),(2,'bundle'),(3,'super'),(4,'up_sell'),(5,'cross_sell'); insert into `catalog_product_link_attribute`(`product_link_attribute_id`,`link_type_id`,`product_link_attribute_code`,`data_type`) values (1,2,'qty','decimal'),(2,1,'position','int'),(3,4,'position','int'),(4,5,'position','int'),(6,1,'qty','decimal'),(7,3,'position','int'),(8,3,'qty','decimal'); insert into `cataloginventory_stock`(`stock_id`,`stock_name`) values (1,'Default');
Probably should also clear/refresh/disable cache from System > Cache Management. I also like to delete everything under my ./var directory as well just to be doubly sure its all clear.
If you forget to truncate the other tables, or if you forget to restore the default values afterward, you’ll have foreign key issues later.
Awesome find Mike Smullin! I was able to clear out my entire import that got fouled up, Since I’m on a development server right now Magento’s admin would simply bomb out on multiple delete’s of products. Now I can get back to Re-Importing. And your query didn’t even clear out my product attributes. Is it Okie if I repost these queries on my personal blog (with credit of course!) ?
Great find, just want i was looking for after i have screwed up a test database with the Import tool.
This is off-topic, but just curious has anybody had problem with the Import utility working on the local development system, but having it not work in a hosted production server environment?
Great find, just want i was looking for after i have screwed up a test database with the Import tool.
This is off-topic, but just curious has anybody had problem with the Import utility working on the local development system, but having it not work in a hosted production server environment?
Again, thanks Mike for the wonderful tip!
Compare your local dev environment to production particularly php.ini and my.cnf same hosting environments? or one unix and other win32?
here’s a script i wrote to help track down all the tables affected when you delete a product.
I started with a script that spits out the count of every table, then I deleted a product, then I ran the script again to get the new counts of all the tables. I took the 2 outputs and did a diff and tracked everything down. I’m pretty sure I covered everything.
basically there are 2 main foreign keys: entity_id and product_id.. there’s the one table with rule_product_id too
this should be helpful. you can easily replace SELECT * with DELETE
all the tables affected should be between the 3 arrays
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,'0000-00-00 00:00:00','2009-02-20 00:25:34','1',1,0,1),(2,3,3,0,'2009-02-20 00:25:34','2009-02-20 00:25:34','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');
My categories are gone indeed but now I have a category ‘Default Category’ which wont turn op one the front end and subcategories neither.
Im on Magento 1.3.2 with Flat Catagog / Products enabled. Run every cache refresh and deleted all the files in /var/chache and /var/session - None helped
What to do?
FORGET ABOVE:
Forget to set my Root Category in my Store view.
in the admin panel goto
System->Manage Store
click “Main Website Store” and check that “Root Category” is set to your default category.
This is likely to be a stupid question, but if I delete all products and reimport my database backup, will the products id still be resetted? My problem is that my product ids start at 17 and I would like them to start at 1 again but I dont want to have to manually insert those products. Thanks!