Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Deleting Categories With PhpMyAdmin - How to?


RMD27

Recommended Posts

Ive uploaded a load of products with thousands of categories.

 

Would have been okay but there was an error with the category names.

 

I have deleted all the products with EasyPopulate

 

My issue is how to delete the categories.

 

There are too many categories to do it through the admin. It will not load up the category edit page so I the only way forward I see to delete the categories is to delete through phpmyadmin

 

My question is how do I do this?

 

Just go into the category table and delete the offending categories. I am deleting all the categories and starting again. I can just delete the parent category??

 

I saw this but I want clarification

 

http://www.oscommerce.com/forums/topic/368744-remove-empty-categories/

Link to comment
Share on other sites

I would truncate categorys / category description and product to category tables (you will see probably a button on the right  called operations)

 

and check again all the product tables

 

double check that easy populate as really deleted all the product  values make sure they are really gone

 

Regards

Joli

To improve is to change; to be perfect is to change often.

 

Link to comment
Share on other sites

Hi

 

I did roll up some of the sql I have written into a contibution called Databae Check Tool

 

http://addons.oscommerce.com/info/9087

 

Truncate categories using phpmy admin

 

Reload using EP and the correct categories.

 

Run the database check, the will be category descriptions without category records and the add-on will correct that.

 

HTH

 

G

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

Hi

 

I did roll up some of the sql I have written into a contibution called Databae Check Tool

 

http://addons.oscommerce.com/info/9087

 

Truncate categories using phpmy admin

 

Reload using EP and the correct categories.

 

Run the database check, the will be category descriptions without category records and the add-on will correct that.

 

HTH

 

G

this looks amazing

 

im on 2.2 so ill use this version http://addons.oscommerce.com/info/5973

Link to comment
Share on other sites

ok so I installed this http://addons.oscommerce.com/info/5962

 

what i really need to know is how to do bulk delete of rows in phpadmin.

 

from what you say, deleting the category and category descriptions rows will do what i want.

 

I need to delete around 35,000 categories, do you know what query I can enter to carry that out in one hit? 

 

ie delete 35000 rows for the category table and 35000 from the category description table.

 

at the moment I sort the rows by id number and delete 500 at a time. 

---

 

I understand what you say about truncating the table but there are too many products for me to reupload the categories through ep, there must be 300,000+

Link to comment
Share on other sites

the query

 

delete * from categories

 

will delete EVERYTHING from categories (id records)

 

delete * from categories_description

 

will delete EVERYTHING description (each and every language)

 

delete * from products_to_categories

 

will delete ALL product to category links

 

SO ONLY DO THIS IF YOU ARE REALLY SURE YOU WANT NOTHING LEFT

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

You could try

 

delete * from categories where category_id > xxxxxxx

 

in phpmy admin and set xxxx so only the most recent categories are deleted.

 

still 35000 / 500 = 70 delete actions

 

30 seconds versus 1 hr

 

HTH

 

G

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

I would truncate categorys / category description and product to category tables (you will see probably a button on the right  called operations)

 

and check again all the product tables

 

double check that easy populate as really deleted all the product  values make sure they are really gone

 

Regards

Joli

joli

 

You are quite right. easy populate did not delete the products.

 

If I was going to do all this from the start I would delete the products by going through the manufacturers page in the admin first and see if that allowed the category to load in the admin.

 

as it stands now, i deleted the parent category hoping that would delete the sub categories (but it didnt) now there is no way for me to access the parent category through the admin.

 

I dont suppose there is any way to reinsert the parent category into the category and catgeories description table is there?

Link to comment
Share on other sites

You could try

 

delete * from categories where category_id > xxxxxxx

 

in phpmy admin and set xxxx so only the most recent categories are deleted.

 

still 35000 / 500 = 70 delete actions

 

30 seconds versus 1 hr

 

HTH

 

G

of course! :D 

 

not quite 30 seconds job but much much much quicker! it actually gives the query in the red box when you delete a row manually. i didnt think of using it!  :wacko: 

 

I used the concatenate function in xcel to build the 30,000+ queries i needed to delete all the rows. Touch wood. all seems to be working okay now

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...