dj sunny omkar Posted May 23, 2011 Share Posted May 23, 2011 i have many employees in my organizations i want one employee to take care of one categories alone without disturbing other categories or viewing other categories.I could achive this by creating a profile and enabling the view permit for catalog ..But i want to restrict an employee for a particular categorie alone how do i achive this please help ?? 1 Link to comment Share on other sites More sharing options...
shokinro Posted May 23, 2011 Share Posted May 23, 2011 I don't think you can do this without code modification, because the profile control is at catalog level.I you would like to do that, you can look into following file inside __construct, add some control after following lines. $this->_category = AdminCatalog::getCurrentCategory(); Link to comment Share on other sites More sharing options...
dj sunny omkar Posted June 7, 2011 Author Share Posted June 7, 2011 can i restrict the access to particular user say [email protected] to a particular categories say "xyz"what code should i add to make it work? Link to comment Share on other sites More sharing options...
shokinro Posted June 7, 2011 Share Posted June 7, 2011 after this line $this->_category = AdminCatalog::getCurrentCategory(); add this two lines global $cookie; if($this->_category->id != X AND $cookie->id_employee != Y)die("you don't have permission"); where X is the category ID that allow the employee to accessY is there ID of employee By the way, I have multiple seller module, that handle much more permission scenarios.It allow customer to become a seller of your store. You can also register other seller at back office.All seller can only access their own products, customer and order. There are a lot of more features if you in interested, you can have a look at this threadhttp://www.prestashop.com/forums/viewthread/104232/ Link to comment Share on other sites More sharing options...
efams Posted August 21, 2011 Share Posted August 21, 2011 I read the features of the module. Very interesting, I'll take shortly. Let me know if it is possible to do this: A category is shared between multiple vendors, but each seller can edit only products added by him. Link to comment Share on other sites More sharing options...
shokinro Posted August 21, 2011 Share Posted August 21, 2011 I read the features of the module. Very interesting, I'll take shortly. Let me know if it is possible to do this: A category is shared between multiple vendors, but each seller can edit only products added by him. Yes, you can do this. Any category created by Admin is shared by all sellers and vendors. Thanks for your question. Link to comment Share on other sites More sharing options...
efams Posted August 22, 2011 Share Posted August 22, 2011 I read the features of the module. Very interesting, I'll take shortly. Let me know if it is possible to do this: A category is shared between multiple vendors, but each seller can edit only products added by him. Yes, you can do this. Any category created by Admin is shared by all sellers and vendors. Thanks for your question. Thanks for the reply. I understand that the categories are shared, but the seller can only edit the articles entered by him in that category or all the articles? Link to comment Share on other sites More sharing options...
shokinro Posted August 22, 2011 Share Posted August 22, 2011 Thanks for the reply.I understand that the categories are shared, but the seller can only edit the articles entered by him in that category or all the articles? Yes, in the shared categories, the seller can see/edit his/her own products. Link to comment Share on other sites More sharing options...
Righthe Posted January 23, 2012 Share Posted January 23, 2012 Please help, i am not able to restrict the permissions at Category level for employees by using the code given above.... I am using 1.5 version of prestashop. i edit the file AdminCmscontroller.php.(am i editing the right file?) added the code like... $this->_category = AdminCmsContentController::getCurrentCMSCategory(); global $cookie; if($this->_category->id != 2 AND $cookie->id_employee != 2)die("you don't have permission"); (added this line) if($this->_category->id != 3 AND $cookie->id_employee != 3)die("you don't have permission"); (added this line) $this->_join = ' LEFT JOIN `'._DB_PREFIX_.'cms_category` c ON (c.`id_cms_category` = a.`id_cms_category`)'; $this->_select = 'a.position '; $this->_filter = 'AND c.id_cms_category = '.(int)($this->_category->id); Link to comment Share on other sites More sharing options...
shokinro Posted January 23, 2012 Share Posted January 23, 2012 I have multiple seller module that take care of this stuff and it has many more othere features. if you are interested, you can have a look at this thread. Link to comment Share on other sites More sharing options...
rajlaskar Posted January 28, 2014 Share Posted January 28, 2014 (edited) it can be easily achieved by this add a filed in employee table supplier_id , Link employee table and supplier table through this filed, insert supplier_id in employee table then create a employee profile with only catalog privileges change the code in "AdminProductsController" in where clause add supplier_id , [session supplier id] this will show the products of that employee linked with the supplier id can anyone please tell me where to set the cookie for new employee table filed "supplier_id" Edited January 29, 2014 by rajlaskar (see edit history) Link to comment Share on other sites More sharing options...
stuka Posted January 11, 2015 Share Posted January 11, 2015 after this line $this->_category = AdminCatalog::getCurrentCategory(); add this two lines global $cookie;if($this->_category->id != X AND $cookie->id_employee != Y)die("you don't have permission"); where X is the category ID that allow the employee to access Y is there ID of employee By the way, I have multiple seller module, that handle much more permission scenarios. It allow customer to become a seller of your store. You can also register other seller at back office. All seller can only access their own products, customer and order. There are a lot of more features if you in interested, you can have a look at this thread http://www.prestashop.com/forums/viewthread/104232/ Dear All it is possible to implement in presta 1.6? . i need also block some categories for some employe's. in presta 1.6 i canot find tlis line .... thx Arek Link to comment Share on other sites More sharing options...
stuka Posted January 11, 2015 Share Posted January 11, 2015 When i add this line global $cookie;if($this->_category->id != X AND $cookie->id_employee != Y)die("you don't have permission"); in to AdminProductsController.php and then i go to BO and when i click add produck i have info "you dont have permition" this should block category.... how can i block some categotiy in presta 1.6? Arek Link to comment Share on other sites More sharing options...
shokinro Posted January 11, 2015 Share Posted January 11, 2015 (edited) I guess you want to this at back office catalogue, to block an employee from access category, you need add related code in following file /controllers/admin/AdminCategoriesController.php Edited January 11, 2015 by shokinro (see edit history) Link to comment Share on other sites More sharing options...
stuka Posted January 11, 2015 Share Posted January 11, 2015 I guess you want to this at back office catalogue, to block an employee from access category, you need add related code in following file /controllers/admin/AdminCategories.php Yes i want to block in backoffice, in presta 1.6 i can only find file : AdminCategoriesController.php , could You advice me after which line i need to past this code? : lobal $cookie;if($this->_category->id != X AND $cookie->id_employee != Y)die("you don't have permission"); thx Arek Link to comment Share on other sites More sharing options...
shokinro Posted January 11, 2015 Share Posted January 11, 2015 sorry, it is AdminCategoriesController.php instead of AdminCategories.php, I modified the post. you can try to add the code after this line public function init(){ parent::init(); // context->shop is set in the init() function, so we move the _category instanciation after that if (($id_category = Tools::getvalue('id_category')) && $this->action != 'select_delete') $this->_category = new Category($id_category); else { if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) $this->_category = new Category($this->context->shop->id_category); elseif (count(Category::getCategoriesWithoutParent()) > 1 && Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && count(Shop::getShops(true, null, true)) != 1) $this->_category = Category::getTopCategory(); else $this->_category = new Category(Configuration::get('PS_HOME_CATEGORY')); } Link to comment Share on other sites More sharing options...
stuka Posted January 11, 2015 Share Posted January 11, 2015 (edited) sorry, it is AdminCategoriesController.php instead of AdminCategories.php, I modified the post. you can try to add the code after this line public function init(){ parent::init(); // context->shop is set in the init() function, so we move the _category instanciation after that if (($id_category = Tools::getvalue('id_category')) && $this->action != 'select_delete') $this->_category = new Category($id_category); else { if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) $this->_category = new Category($this->context->shop->id_category); elseif (count(Category::getCategoriesWithoutParent()) > 1 && Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && count(Shop::getShops(true, null, true)) != 1) $this->_category = Category::getTopCategory(); else $this->_category = new Category(Configuration::get('PS_HOME_CATEGORY')); } i just add this one line after your code: if ($this->_category->id != 4 AND $cookie->id_employee != 1)die("you don't have permission"); and when i click on category on BO i see only "you dont have parmition" , but i should see it when i try to click on sub category with ID 4. what im doing wrong? also i just try with this 2 lines: global $cookie; if ($this->_category->id != 4 AND $cookie->id_employee != 1)die("you don't have permission"); now i have access to BO / categoty but cat with id4 still exist. basicly also not working Edited January 11, 2015 by stuka (see edit history) Link to comment Share on other sites More sharing options...
stuka Posted January 11, 2015 Share Posted January 11, 2015 After tests this is working line: if ($this->_category->id != 2 AND $cookie->id_employee != 2)die("you don't have permission"); _category->id != 2 - it is main category , but when i click on next subdirectory i have info you dont have permiission, i also try to add more lines example: if ($this->_category->id != 2 AND $cookie->id_employee != 2)die("you don't have permission"); if ($this->_category->id != 3 AND $cookie->id_employee != 2)die("you don't have permission"); if ($this->_category->id != 4 AND $cookie->id_employee != 2)die("you don't have permission"); but without success, how can i solve this? Link to comment Share on other sites More sharing options...
stuka Posted January 11, 2015 Share Posted January 11, 2015 Also i have a question, it is possible to connecto only one or 2 categories in tree category to one emplotte? like on my picture: example : Employee ID: 2 should have onny acceess his category T-shirts. Link to comment Share on other sites More sharing options...
Dhiro Posted October 2, 2016 Share Posted October 2, 2016 Good day. The information above is very usefull, but little bit not actual. Who can tell, how to restrict for employees showing orders with specific "id_current_state" or "current_state" on the "Orders" page (where is located list of orders, not just 1 order). For example, do not display orders with status "Delivered". I found that presta using this table in next files: classes/controller/AdminController.php:3221 /classes/order/OrderState.php:129 /Adapter/Adapter_EntityMapper.php:68 But it's little bit not exactly what I need, probably I need to edit tpl file, but there is no any info in debug mode about used tpl files on current page. I have 2 ways - but dont have clear idea what to do: Way #1 in orderState.php - Edit php file (I tried to get global employee_id and if (employee_id != 1 && id_order_state == 11) just to do not write such raw into $result variable. Probably it's a wrong way, at least after such changes my orders page didnt work Way #2 - find tpl file and in the same way do not display such orders, with special status. (probably it must work like existing filter, but I also can't find filter's logic) Maybe somebody faced already with such problem, or knows where to found needed tpl files. Thank you! 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