I am still working on my new mod 'Categeory Specific Access Restriction'
So far all hacks are working a treat for top categories. However, if I want to restrict a subcategory the mod fails.
Here is what I have done so far:
File includes/index_filters/default_filter.php looks like this:
Then added $block_these to each of the where settings.Code:if (!defined('IS_ADMIN_FLAG')) { die('Illegal Access'); } // CATEGORY_RESTRICTION: test for restricted categories and if found then don't show their products in the listing $category_login_query = array(",",CATEGORY_RESTRICTION_LOGIN_CATEGORY); foreach($category_login_query as $category_login); if (isset($_SESSION['customer_id']) && isset($_SESSION['customers_privileges']) && $_SESSION['customer_id'] > 0 && $_SESSION['customers_privileges'] > 0) { $block_these = ''; } else { $block_these = " and p.master_categories_id != '$category_login' "; } .... rest of the file ....
Did the same in these files:
includes/modules/pages/advanced_search_result/header_php.php
includes/modules/pages/featured_products/header_php.php
includes/modules/pages/products_all/header_php.php
includes/modules/pages/products_new/header_php.php
includes/modules/pages/specials/main_template_vars.php
The hack does not work when I am adding a subcategories ID to the array CATEGORY_RESTRICTION_LOGIN_CATEGORY -- it throws no error either!
Demo site here - ZC version 1.5.1 - new installation
Click category 'Mixed Category' and you still see the listing of products 'Mixed Must Login 1' and 'Mixed Must Login 2'. These two products should not show up.
Now click on 'All Products' or 'New Products' and you still see the listing of products 'Mixed Must Login 1' and 'Mixed Must Login 2' BUT you don't see products from the top category entitled 'Must-Login-category' - just as desired.
All good for the top categories but not for the Mixed Must Login Products in the subcat Mixed Must Login
Appreciate some comments/hints or solutions
Thanks / Frank


Reply With Quote
