Osclass forums
Development => Development => Topic started 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,
-
No solution?
-
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.
-
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
-
I'm not 100% sure, that's why I said you to make a backup. Test and report any errors.
Regards.
-
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
-
.
-
.