Dave Angel Posted July 27, 2015 Share Posted July 27, 2015 (edited) Hi, I would like to know what sql I can run that will disable all products from a certain manufacturer, for example; UPDATE `ps_product` SET `active` = 0 WHERE `id_manufacturer` = 118 This obviously sets all products from manufacturer 118 to active =0 or turns them off, but it doesn't. I have also found that there is an active=1 or 0 in the table ps_product_shop. The problem is ps_product_shop does not have the id_manufacturer column only the id_product column is in both tables. So, how do I join the script together to turn the active=0 in both tables? UPDATE `ps_product` SET `active` = 0 WHERE `id_manufacturer` = 118 UPDATE `ps_product_shop` SET `active` = 0 WHERE `id_product` = (id_product from ps_product where id_manufacturer=118) My sql (no pun intended) is not good enough to be able to work on two tables at the same time so any help would be immense!! This is for PS v1.6.0.11 Many thanks, Rob. Edited July 27, 2015 by Dave Angel (see edit history) Link to comment Share on other sites More sharing options...
musicmaster Posted July 27, 2015 Share Posted July 27, 2015 The easiest way to do this with my free Triple Edit script. My next preference would be using a PHP script. That way you can avoid the complexity in MySql. An additional benefit is that in PHP you can easily insert debug code what makes the chances on error smaller. I am not sure about the nested MySql code. At least you need to start the part between brackets with "select". It may also be that you need to replace the "=" before the brackets with "IN" but I am not sure about that. Link to comment Share on other sites More sharing options...
Dave Angel Posted July 28, 2015 Author Share Posted July 28, 2015 Thanks for taking the time to reply. PHP does sound like an easier route to take. I'll have a look at your Triple Edit tool now. Sounds pretty good. 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