
Originally Posted by
AndyII
Can you give an example of a restriction needed for "categories"?
Yes. Though there are usually multiple ways of going about this and what is appropriate would depend upon the specific requirement you were trying to meet.
For example, if you are restricting admin users to a single category, you would need suppress the dropdown menu on the categories page that allows them to navigate to other categories. To do this you would need to find the following code in the category_product_listing module, which generates that dropdown
PHP Code:
if ($_SESSION['display_categories_dropdown'] == 0) {
echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'set_display_categories_dropdown=1&cID=' . $categories->fields['categories_id'] . '&cPath=' . $cPath . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image(DIR_WS_ICONS . 'cross.gif', IMAGE_ICON_STATUS_OFF) . '</a> ';
echo zen_draw_form('goto', FILENAME_CATEGORIES, '', 'get');
echo zen_hide_session_id();
echo HEADING_TITLE_GOTO . ' ' . zen_draw_pull_down_menu('cPath', zen_get_category_tree(), $current_category_id, 'onChange="this.form.submit();"');
echo '</form>';
} else {
echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'set_display_categories_dropdown=0&cID=' . $categories->fields['categories_id'] . '&cPath=' . $cPath . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image(DIR_WS_ICONS . 'tick.gif', IMAGE_ICON_STATUS_ON) . '</a> ';
echo HEADING_TITLE_GOTO;
}
and wrap an if statement around it so that it is only executed if the user is allowed to go to other categories.
If they are allowed access to different categories, but only a limited subset, you would need to change the same bit of code in a different way. In this case you would need to replace the zen_get_categories_tree() function with an alternative that prepared a list of the categories to which the user is to have access.
Bookmarks