Advertisement:

Author Topic: category id  (Read 506 times)

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 416
category id
« 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,

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 416
Re: category id
« Reply #1 on: February 05, 2019, 12:21:58 pm »
No solution?

WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
Re: category id
« Reply #2 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.

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 416
Re: category id
« Reply #3 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

WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
Re: category id
« Reply #4 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.

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 416
Re: category id
« Reply #5 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

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 416
Re: category id
« Reply #6 on: March 19, 2019, 09:26:05 am »
.
« Last Edit: April 27, 2019, 11:51:04 am by Sophia_OS »

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 416
Re: category id
« Reply #7 on: April 10, 2019, 05:50:21 am »
.
« Last Edit: April 27, 2019, 11:50:37 am by Sophia_OS »