Osclass forums

Development => Development => Topic started by: Sophia_OS on October 09, 2018, 12:15:00 am

Title: category id
Post by: Sophia_OS on October 09, 2018, 12:15:00 am
hey,
i wanna rename category ID (oc_t_category -> pk_i_id), but there are items recorded with this category ID in the database,
what is the safest way to change category ID?
thanks,
Title: Re: category id
Post by: Sophia_OS on February 05, 2019, 12:21:58 pm
No solution?
Title: Re: category id
Post by: WEBmods on February 06, 2019, 12:08:06 am
Hello,

First BACKUP your database.
Go to phpmyadmin SQL tab and write "UPDATE PREFIXt_category SET pk_i_id = NEW_ID WHERE pk_i_id = OLD_ID", but untick "Enable foreign key checks".

Then again go to phpmyadmin SQL tab and write "UPDATE PREFIXt_item SET fk_i_category_id = NEW_ID WHERE pk_i_id = OLD_ID", but untick "Enable foreign key checks".

After that recount category stats in admin -> tools -> category stats.

Regards.
Title: Re: category id
Post by: Sophia_OS on February 07, 2019, 10:35:36 pm
Hello,

First BACKUP your database.
Go to phpmyadmin SQL tab and write "UPDATE PREFIXt_category SET pk_i_id = NEW_ID WHERE pk_i_id = OLD_ID", but untick "Enable foreign key checks".

Then again go to phpmyadmin SQL tab and write "UPDATE PREFIXt_item SET fk_i_category_id = NEW_ID WHERE pk_i_id = OLD_ID", but untick "Enable foreign key checks".

After that recount category stats in admin -> tools -> category stats.

Regards.

Thank you very much for the answer.
Is there only these two spots stores category id?
Is changing category id safe? I wont get any errors in the future?
Thanks
Title: Re: category id
Post by: WEBmods on February 07, 2019, 11:02:32 pm
I'm not 100% sure, that's why I said you to make a backup. Test and report any errors.

Regards.
Title: Re: category id
Post by: Sophia_OS on February 08, 2019, 12:43:00 am
I'm not 100% sure, that's why I said you to make a backup. Test and report any errors.

Regards.

Thank you very much
Title: Re: category id
Post by: Sophia_OS on March 19, 2019, 09:26:05 am
.
Title: Re: category id
Post by: Sophia_OS on April 10, 2019, 05:50:21 am
.