Restricting admin user to specific product category

I have a very old version of cs-cart (1.3.3-sp2) and I am trying to limit certain admin users to manage specific product categories (and their subcategories).



My plan is to identify these limited admins as a group by their membership_id, and then to identify the specific product category assigned to them by putting it somewhere in their profile (such as in the fax number).



Unfortunately I am a total newbie at PHP, but I have nevertheless made some limited progress.


  1. In products.php, there is the following line:



    $all_categories_list = fn_get_plain_categories_tree(0, false);



    I have found that by changing “0” to a specific category number (eg 123), I can restrict the category tree to just the 123 subcategories, BUT I would like a tree that starts with and INCLUDES category 123 itself.



    Any suggestions on the correct function to achieve this?


  2. If I can achieve step 1, then I just need to know how to retrieve and assign the membership_id and the category number stored in the fax number field.



    Maybe a command like this?



    $cart['user_data'] = fn_get_user_info($auth['user_id']);



    I am not sure though how to then get the membership_id and fax into their own separate variables.



    Or… maybe I am going about this all wrong!



    Any suggestions on how to achieve my objective would be greatly appreciated.