Forums / General Questions / how to create or edit specific category id number?

how to create or edit specific category id number?

Locked

Views: 794

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
3 Sep 2010, 7:27 PM
#1
gsdcypher avatar

gsdcypher

Totally Zenned

Join Date:
Feb 2007
Posts:
816
Plugin Contributions:
0

how to create or edit specific category id number?

what is the "best/safest" way to create a category with a specific id number?

or edit an id number say 311 change to 88?

thanks.

3 Sep 2010, 8:03 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: how to create or edit specific category id number?

The category id is auto-generated by the database, and incremented to one more than the last created category id. It would be dangerous to alter that; if you were to alter it to a no-longer-used number, there are other tables where you would have to make the same alteration.

3 Sep 2010, 8:20 PM
#3
gsdcypher avatar

gsdcypher

Totally Zenned

Join Date:
Feb 2007
Posts:
816
Plugin Contributions:
0

Re: how to create or edit specific category id number?

thanks gjh42.

what happened was i had a category 88 but it didn't have any subcats. i need to add subcats. so i created a new cat with subcats 311 and put everything in there. but i accidentally deleted cat 88. :-(

so now i want to rename 311 to 88...
or create a new cat 88 and copy everything from 311 into it.

the only reason i am considering doing this is because i have links indexed to the cat 88...

any advice?

thanks.

3 Sep 2010, 11:42 PM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: how to create or edit specific category id number?

This requires someone like Ajeh with intimate knowledge of the database tables, who can tell you all the tables that need to be coordinated for this task (and the SQL to do it).

4 Sep 2010, 1:23 AM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: how to create or edit specific category id number?

Backup your database before doing this ...

Then run the following SQL commands to rebuild the tables so that all references to Categories to change categories_id 311 to 88 ...

UPDATE categories SET categories_id = 88 WHERE categories_id = 311;

UPDATE categories_description SET categories_id = 88 WHERE categories_id = 311;

UPDATE products SET master_categories_id = 88 WHERE master_categories_id = 311;

UPDATE products_to_categories SET categories_id = 88 WHERE categories_id = 311;

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

7 Sep 2010, 4:50 PM
#6
gsdcypher avatar

gsdcypher

Totally Zenned

Join Date:
Feb 2007
Posts:
816
Plugin Contributions:
0

Re: how to create or edit specific category id number?

you know you're awesome! as always, thanks ajeh!!!

:bigups:

7 Sep 2010, 5:04 PM
#7
gsdcypher avatar

gsdcypher

Totally Zenned

Join Date:
Feb 2007
Posts:
816
Plugin Contributions:
0

Re: how to create or edit specific category id number?

you know you're awesome! as always, thanks ajeh!!!

:bigups: