andreiven Posted February 13, 2017 Share Posted February 13, 2017 Some of my products have as default category the root category which is called 'Categories' (I believe there is yet another root category in which this one lies but that doesn't matter here). I say some of the products because when they were inserted in prestashop some were checked inside their own category and some were checked inside this 'Categories' also. The default category for a product in prestashop is the most parent category in which it lies. You can change this of course inside the catalog for each product. The deal is I have over 2000 products and I don't want to check every product and change the default category if it's necessary. After I uncheck the 'Categories' for a product, the next parent category becomes the default one. I have found out the id of the 'Categories' which is 2. And I tried using this command inside phpMyAdmin: update ps_category_product set id_category = replace(id_category, 'Old ID', 'New ID'); which is this: update ps_category_product set id_category = replace(1, '2', ' '); The problem is this doesn't work and I get an error. Does anyone think of another way of doing this? Link to comment Share on other sites More sharing options...
JeredBolton Posted February 13, 2017 Share Posted February 13, 2017 The mysql REPLACE function works on strings - see the example here for more information. The default category ID is set via id_category_default on the ps_product table so you could try something like UPDATE `ps_product` SET `id_category_default`=2 WHERE `id_category_default`=1 Link to comment Share on other sites More sharing options...
musicmaster Posted February 13, 2017 Share Posted February 13, 2017 If you prefer an interface you can try Prestools - it is free. 1 Link to comment Share on other sites More sharing options...
andreiven Posted February 15, 2017 Author Share Posted February 15, 2017 Prestools did the job! Thank you, sir! 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now