josias Posted October 24, 2012 Share Posted October 24, 2012 (edited) Hello, I just have created a new group of customers. My problem is: by default all categories for this new group are disabled. How I could enable all the categories for this new group? Thank you! Edited October 24, 2012 by josias (see edit history) Link to comment Share on other sites More sharing options...
Valérie Assetskaya Posted October 24, 2012 Share Posted October 24, 2012 Hi, It is necessary to create a record for all categories with this group in category_group table. Best regards Link to comment Share on other sites More sharing options...
josias Posted November 5, 2012 Author Share Posted November 5, 2012 Hi, It is necessary to create a record for all categories with this group in category_group table. Best regards Could you be more specific please? I don't know how to do the thing you explain Thank you Best regards Link to comment Share on other sites More sharing options...
Valérie Assetskaya Posted November 5, 2012 Share Posted November 5, 2012 Hi, It is necessary to create a file in PrestaShop root (updCategoryGroup.php), and call it, it can be done even from browser line -myStore.com/updCategoryGroup.php Then add the following code: <?php require(dirname(__FILE__).'/config/config.inc.php'); $new_group = 4; // there is ID of new group $categories = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT DISTINCT c.* FROM `'._DB_PREFIX_.'category` c LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.(int)Context::getContext()->language->id.') '); foreach($categories as $category){ $categoryObj = new Category($category['id_category'], (int)Context::getContext()->language->id); $categoryObj->addGroups(array($new_group)); } Best regards. 2 Link to comment Share on other sites More sharing options...
jujutte24 Posted February 14, 2013 Share Posted February 14, 2013 Hi, do it work ? I'd like to apply all groups for all categories.... Link to comment Share on other sites More sharing options...
maximo88 Posted November 1, 2013 Share Posted November 1, 2013 Yes, it's perfect. I have take 4 hours to find it. It's reported on github. Thank you Valérie. Thank you so much... Link to comment Share on other sites More sharing options...
beke Posted November 28, 2013 Share Posted November 28, 2013 Hi, anyone knows if this script works fine for Prestashop 1.5.6? My installation has over 400 categories/subcategories and it's very hard to do this manually. Link to comment Share on other sites More sharing options...
Recommended Posts