Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / reset master categories ID?

reset master categories ID?

Views: 3,836

Results 1 to 10 of 10
14 Jan 2012, 2:59 PM
#1
bonnit avatar

bonnit

Zen Follower

Join Date:
Jun 2009
Location:
Kent, UK
Posts:
350
Plugin Contributions:
0

reset master categories ID?

hi,

is there a sql statement i can use to bulk reset master ID for multiple categories, im aware of the tool to do it one at a time however i use easy populate and am adding a minimum of 10-20 products a day from multiple categories.

easy populate doesnt specify a master ID for the categories so i have to do each one individually. my categories rarely change so it would be a case of running the same statement each time that i would run quickly after adding new products.

does anyone know if there is a quicker way of doing it other than the tool to do it individually please?

any help very much appreciated :)

14 Jan 2012, 3:11 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: reset master categories ID?

You could go to one of the Products in the Category you need reset and click C for Copy then the Multiple Categories Link Manager ...

There is a setting for:

Reset ALL Products in the selected Category to use the selected Category as the new Master Categories ID ...
Example: Resetting Category 22 would set ALL Products in Category 22 to use Category 22 as the Master Category ID

That would set all the Products in a specific Category to use that Category as its master_categories_id ...

14 Jan 2012, 3:15 PM
#3
bonnit avatar

bonnit

Zen Follower

Join Date:
Jun 2009
Location:
Kent, UK
Posts:
350
Plugin Contributions:
0

Re: reset master categories ID?

thanks ajeh, thats the way im doing it at the moment however each day after putting a number of products over a number of different categories and linking them etc etc - i have quite a few categories that need to be reset, i was wondering if there was a quicker way of resetting the master id for multiple categories at once??

14 Jan 2012, 3:15 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: reset master categories ID?

Do you use Linked Products?

14 Jan 2012, 6:06 PM
#5
bonnit avatar

bonnit

Zen Follower

Join Date:
Jun 2009
Location:
Kent, UK
Posts:
350
Plugin Contributions:
0

Re: reset master categories ID?

hello again ajeh thansk for replying, yes i do so i cannot use the store manager option to reset all either?

14 Jan 2012, 6:24 PM
#6
ajeh avatar

ajeh

Oba-san

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

Re: reset master categories ID?

You can use it, but with Linked Products it is not the best way to do it as the master_categories_id is set based on the first categories_id found in the products_to_categories table and that is not always the correct one ...

16 Jan 2012, 12:42 PM
#7
bonnit avatar

bonnit

Zen Follower

Join Date:
Jun 2009
Location:
Kent, UK
Posts:
350
Plugin Contributions:
0

Re: reset master categories ID?

sorry ajeh i think you may have misread my post :) i know that i cannot use that one as it wipes out my linked categories.

i dont suppose there is an sql statement or an addon paid or unpaid which will allow me to reset multiple categories to be the master id?

16 Jan 2012, 2:18 PM
#8
ajeh avatar

ajeh

Oba-san

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

Re: reset master categories ID?

Products have 1 master_categories_id ... the update in the Store Manager picks from the products_to_categories the first categories_id it finds on a search for the products_id in that database ...

Unfortunately, that is not always the right categories_id to use, when Products are Linked Products ...

I do not know of anything that makes a better choice, however I did write a test program that for large databases that turns off the indexes before getting the categories_id for a Product from the products_to_categories table so that the first record in the table is selected as that is often a "better" choice ...

Post #29 of this thread:
http://www.zen-cart.com/forum/showthread.php?t=188207

has the updater test program that I made for Large databases that does this ...

NOTE: be sure to backup your database before trying to use it ...

17 Jan 2012, 1:16 PM
#9
bonnit avatar

bonnit

Zen Follower

Join Date:
Jun 2009
Location:
Kent, UK
Posts:
350
Plugin Contributions:
0

Re: reset master categories ID?

thanks ajeh, i did check that out however i think its complicating what i need a bit tbh. i just need a space where i can literally type

96,97,98,99,100,101,105,106,108,109,110,111,115,121,122,186,194,204,206,211,222,223,224,225,226,227,228,245,262

to reset the categories at once or excecute an sql statement which loops through each category number :/

its proving more difficult than i first thought :)

17 Jan 2012, 2:35 PM
#10
ajeh avatar

ajeh

Oba-san

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

Re: reset master categories ID?

Afraid that there is nothing like that at this time ...

You could always write something for that ...