BTutt Posted July 23, 2015 Share Posted July 23, 2015 I have created a custom group (for pricing purposes). I have thousands or products and hundreds of categories. Is there a fast way to set this group access on every product and every category without having to click the check box on each item?The image shows the painful way of clicking a check box in every category and product. I hope to avoid the manual click on all these items. Any ideas? Link to comment Share on other sites More sharing options...
gabdara Posted July 24, 2015 Share Posted July 24, 2015 A SQL query like this should do the work: INSERT IGNORE INTO ps_category_group (id_category, id_group) SELECT id_category, 6 FROM ps_category; 6 is the id of your custom group. Link to comment Share on other sites More sharing options...
BTutt Posted July 24, 2015 Author Share Posted July 24, 2015 A SQL query like this should do the work: INSERT IGNORE INTO ps_category_group (id_category, id_group) SELECT id_category, 6 FROM ps_category; 6 is the id of your custom group. Awesome gabdara! Thank you for the reply. That appears it will do what I need - Add the custom "Members" group to the groups on each category that currently exists. However, I was hoping there was a way to add a new custom group to the default groups so that I do not have to keep checking the check box for every entry added to the shopping cart. The query would work, but I still have many categories to add and then hundreds of products. Clicking a check box on each item is kind of silly. I wish I knew how the default groups were set so that I could just add the new group to the defaults. I believe that solution would automatically check the box and all categories and products would be available to the new group. At least that is what I would expect to happen if I could add it to the default groups. Otherwise, I will have to do a SQL insert every time I add products and/or categories. By the way, I am not knocking your solution at all and I greatly appreciate your help. I import CSV files (products and categories) and I don't see a column for groups. Any other ideas? Link to comment Share on other sites More sharing options...
gabdara Posted July 26, 2015 Share Posted July 26, 2015 I've looked into how the default groups are set and unfortunately they are hard-coded into various files. This is what I've found and it might also be in other files: https://github.com/PrestaShop/PrestaShop/blob/1.6/controllers/admin/AdminCategoriesController.php#L627 https://github.com/PrestaShop/PrestaShop/blob/1.6/controllers/admin/AdminCustomersController.php#L614 https://github.com/PrestaShop/PrestaShop/blob/1.6/classes/Category.php#L1331 https://github.com/PrestaShop/PrestaShop/blob/1.6/classes/LocalizationPack.php#L460 Link to comment Share on other sites More sharing options...
Recommended Posts