Jump to content

Updating Default Category of Products directly in the Database


Recommended Posts

I updated the id_category_default field in the ps_product table to the default category ID that I need. But I notice that this doesn't affect the value in Back Office when you go to update the item, go to Associations, the Default Category still shows the old Category. 

Then I hit save in BackOffice with the same value (old default category selected in the drop down), refresh the db table ps_product and I see the value for id_category_default goes back to the old one.  So this does have an effect when updating in BackOffice, it just doesn't work when updating from the Database.

 

What else should I be updating to change the Default Category for an Item in the database?

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 year later...

WOW i´m working exactly with that issue right now but i´m trying to figure out the SQL query to do that, can someone help me to make the correct SQL sentence?, thanks!  i suppose that this may work when changing massive amout of products, i mean like 2000 items to change it´s default category?, thanks!.

 

 

 

So far this is what it can be done editing 1 by 1 directly both table: from the database:

 

UPDATE `ps_databasename`.`ps_tablename` SET `id_category_default` = 'XXX' WHERE `ps_product_shop`.`id_product` =XXXXXX AND `ps_product_shop`.`id_shop` =1;

 

and as instructed on both tables: ps_product_shop and ps_product

Edited by manonpiano (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...