kelemvor Posted November 8, 2012 Share Posted November 8, 2012 Howdy, Title is pretty self explanatory. Is there any way I can select a category and disable all the items in that category? Or is there a way I can view al lthe items, check some boxes, and choose Disable all? The only button I see when I check the boxes is to delete them. I don't want to have to manualyl disable every item individually so I need some other way to do that. Thanks. Link to comment Share on other sites More sharing options...
Alex Simonchik BelVG Posted November 8, 2012 Share Posted November 8, 2012 (edited) Hi, There is the SQL query for your task: UPDATE `ps_product` SET active = 0 WHERE id_product IN (SELECT id_product FROM `ps_category_product` WHERE `id_category` = 2 GROUP BY id_product) Notice that you need to use your prefix for tables (customPrefix_ instead of ps_) and your id_category (instead of "2") Regards Edited November 8, 2012 by Alexander Simonchik (see edit history) Link to comment Share on other sites More sharing options...
kelemvor Posted November 8, 2012 Author Share Posted November 8, 2012 Is there somewhere within Presta that I can go to run the query or do I have to do it from my actual web host? I've never used SQL with my store before. And do I need to look up what my prefix is? Link to comment Share on other sites More sharing options...
Alex Simonchik BelVG Posted November 8, 2012 Share Posted November 8, 2012 Do you use 1.4.x or 1.5.x version? Link to comment Share on other sites More sharing options...
kelemvor Posted November 8, 2012 Author Share Posted November 8, 2012 PrestaShop™ 1.5.1.0 Link to comment Share on other sites More sharing options...
Alex Simonchik BelVG Posted November 8, 2012 Share Posted November 8, 2012 (edited) Try to create the php file with content: <?php require(dirname(__FILE__).'/config/config.inc.php'); $id_category = 2; //set ID of your category $sql = 'UPDATE `'._DB_PREFIX_.'product` SET active = 0 WHERE id_product IN (SELECT id_product FROM `'._DB_PREFIX_.'category_product` WHERE `id_category` = '.(int)$id_category.' GROUP BY id_product)'; Db::getInstance()->Execute($sql); And rut it (go to you_webstore/somename.php) Edited November 8, 2012 by Alexander Simonchik (see edit history) Link to comment Share on other sites More sharing options...
kelemvor Posted November 8, 2012 Author Share Posted November 8, 2012 OK so my category is 24. It looks like my tables all start with "ps_" so do I have to put that everywhere it says _DB_PREFIX_? And then when I want to reverse this I just change the 0 to a 1 and run it again, right? Link to comment Share on other sites More sharing options...
Alex Simonchik BelVG Posted November 8, 2012 Share Posted November 8, 2012 OK so my category is 24. OK It looks like my tables all start with "ps_" so do I have to put that everywhere it says _DB_PREFIX_? No, in real SQL-query _DB_PREFIX_ will be change to 'ps_' automatically And then when I want to reverse this I just change the 0 to a 1 and run it again, right? Yes, you are right 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