Page 1 of 10 123 ... LastLast
Results 1 to 10 of 96
  1. #1
    Join Date
    Apr 2007
    Location
    Ontario, Canada
    Posts
    1,731
    Plugin Contributions
    27

    Idea or Suggestion Twitch Restrict Categories by Customer or Group

    Twitch Restrict Categories by Customer or Group
    for ZenCart v1.51 - Version 14a
    January 13.2014


    Description:

    - From your admin, this module will allow you to hide categories for multiple customers by new unlimited Group ID assignments, per single category.
    - Works with category tabs, category sidebox and search/advanced search.


    How it Works:

    - In admin each category has a drop down menu that looks for group numbers you create.
    - A new database table stores category_id and customers_cat_group relational data.

    Note: There is no limitation/filter to enforce parent_id control - useful for hiding categories without disabling products.

    - Category_id is set for default 0 so everyone can see the category until you change the Group ID.
    - SQL included to add all existing categories to the new table.
    - Filters are added to category tabs, category sidebox and search/advanced search to only display if category Group ID matches guest/logged in customer Group ID.


    Related Uses:
    Aside from hiding categories here and there, you could think it through a bit more...
    - Without installing a full featured wholesale module you could simply create a wholesale customer group and keep all of the wholesale categories/products separate.
    - Force all categories to have a Group ID != 0, no categories will show for guests - this would make it compatible with Customer Shop Status out of the box.
    - Support tier membership, add categories for higher tiers.
    - Hide seasonal categories/products.


    This module is based on the updated v151 Display Specific Categories for a logged in Customer (single customer per category restriction)


    This module is NOT related to Category Specific Access Restriction (CSAR)
    Twitch.
    https://www.twitchtoo.com Do you work for free? Please donate.
    Twitch Base7 with Wholesale PRO - 88 preinstalled plugins zero errors.

  2. #2
    Join Date
    Apr 2007
    Location
    Ontario, Canada
    Posts
    1,731
    Plugin Contributions
    27

    Default Re: Twitch Restrict Categories by Customer or Group

    Name:  category_edit.JPG
Views: 1599
Size:  26.0 KB

    Waiting for approval here:
    http://www.zen-cart.com/downloads.php?do=file&id=1819

    Available for download with all screenshots here:
    http://twitchtoo.com/zencart/index.html

    Currently working in a bone stock ZenCart v1.51.

    It has also been installed successfully in two other sites running ZenCart 1.51 with the following modules installed:

    Twitch Restrict Categories by Customer or Group

    Admin Display Product/Catalog Thumbnails 1_5

    Twitch TURN OFF SaleMaker & Specials & Discount Coupons for Wholesale Customers
    Twitch SaleMaker & Specials for Attributes
    Twitch Hidden Searchable Model Number
    Twitch Wholesale with Twitch Wholesale Attributes
    Twitch Base_Cost
    Twitch List_Price
    Twitch.
    https://www.twitchtoo.com Do you work for free? Please donate.
    Twitch Base7 with Wholesale PRO - 88 preinstalled plugins zero errors.

  3. #3
    Join Date
    Apr 2011
    Posts
    56
    Plugin Contributions
    0

    Default Re: Twitch Restrict Categories by Customer or Group

    I have the Category Specific Access Restriction (CSAR) module installed on my site. Would this module interfer with it or can they work together?

  4. #4
    Join Date
    Apr 2007
    Location
    Ontario, Canada
    Posts
    1,731
    Plugin Contributions
    27

    Default Re: Twitch Restrict Categories by Customer or Group

    CSAR is based on filtering customers based on store status, Twitch Restrict is based on customers that can be grouped regardless of store status.

    I haven't tried to merge the two to date, what need are you attempting to fill with regards to customer access?
    Twitch.
    https://www.twitchtoo.com Do you work for free? Please donate.
    Twitch Base7 with Wholesale PRO - 88 preinstalled plugins zero errors.

  5. #5
    Join Date
    Apr 2007
    Location
    Ontario, Canada
    Posts
    1,731
    Plugin Contributions
    27

    Default Re: Twitch Restrict Categories by Customer or Group

    The Problem:
    Twitch Restrict Categories by Customer or Group
    Advanced Search Plus 2.0

    Twitch Restrict hides categories, Advanced Search Plus searches categories...

    The Fix:
    In order to hide restricted categories when these two modules are installed together, you need to update:
    includes/modules/YOUR_TEMPLATE/advanced_search_categories.php

    line 47 - 48

    from this:
    $from_str_cat = " from " . TABLE_CATEGORIES_DESCRIPTION . " cd, " . TABLE_CATEGORIES . " c ";
    $where_str_cat = " where c.categories_status <> 0 AND cd.categories_id = c.categories_id and cd.language_id = '" . (int)$_SESSION['languages_id'] . "'"; //2011-03-24 Included c.categories_status <> 0 AND condition to avoid displaying Disabled categories

    to this:
    $from_str_cat = " from " . TABLE_CATEGORIES_DESCRIPTION . " cd, " . TABLE_CATEGORIES_CUSTOMERS . " ccu, " . TABLE_CATEGORIES . " c ";
    $where_str_cat = " where c.categories_status <> 0
    AND cd.categories_id = c.categories_id
    AND cd.language_id = '" . (int)$_SESSION['languages_id'] . "'
    AND c.categories_id = ccu.categories_id
    AND (ccu.customers_cat_group = '" . (int)$_SESSION['customers_cat_group'] . "' OR ccu.customers_cat_group = '0' )"; //2011-03-24 Included c.categories_status <> 0 AND condition to avoid displaying Disabled categories

    Now the search return will hide restricted categories.

    Note: This fix only applies when you have both modules installed.
    Twitch.
    https://www.twitchtoo.com Do you work for free? Please donate.
    Twitch Base7 with Wholesale PRO - 88 preinstalled plugins zero errors.

  6. #6

    Default Re: Twitch Restrict Categories by Customer or Group

    Hi,
    Do you have this available for 1.39h? I know I should upgrade, but haven't got round to it yet. If not, would it need much modification?
    Thanks

  7. #7
    Join Date
    Apr 2007
    Location
    Ontario, Canada
    Posts
    1,731
    Plugin Contributions
    27

    Default Re: Twitch Restrict Categories by Customer or Group

    Yes, it could be modified to work with 1.39h, however I currently don't have a site running 1.39h... I'll need login details for your site admin and FTP to get started. Also, do you have any other mods installed related to customer/category restrictions?
    Twitch.
    https://www.twitchtoo.com Do you work for free? Please donate.
    Twitch Base7 with Wholesale PRO - 88 preinstalled plugins zero errors.

  8. #8
    Join Date
    Apr 2007
    Location
    Ontario, Canada
    Posts
    1,731
    Plugin Contributions
    27

    Default Re: Twitch Restrict Categories by Customer or Group

    The Problem:
    Twitch Restrict Categories by Customer or Group

    Products currently have no filter to restrict them from the rest of the world.


    The Fix:
    If customers_cat_group doesn't match the category you're attempting to access, deny the product exists.
    includes/modules/pages/product_info/header_php.php

    Add at line 32-33:

    // bof Twitch Restrict Categories by Customer or Group
    $sql = "select categories_id, customers_cat_group from " . TABLE_CATEGORIES_CUSTOMERS . " WHERE categories_id = '" . (int)$current_category_id . "'";
    $customer_group = $db->Execute($sql);
    $cust_var = $customer_group->fields['customers_cat_group'];

    if ($cust_var != $_SESSION['customers_cat_group']) {
    // Not Authorized to see this product/not logged into account
    unset($_GET['products_id']);
    unset($breadcrumb->_trail[sizeof($breadcrumb->_trail)-1]['title']);
    $robotsNoIndex = true;
    header('HTTP/1.1 404 Not Found');
    }
    // eof Twitch Restrict Categories by Customer or Group


    Applies to:
    Guest/Everyone - Not Logged In
    Retail & Wholesale - Logged in

    Additional Information:
    This fix works with linked products. Meaning there is one product in multiple categories.
    If the product exists in a restricted category, it inherits the containing category restriction.


    Note: This is NOT the add on that allows you to make individual product restrictions. I'm working on that separately.
    Twitch.
    https://www.twitchtoo.com Do you work for free? Please donate.
    Twitch Base7 with Wholesale PRO - 88 preinstalled plugins zero errors.

  9. #9
    Join Date
    Apr 2007
    Location
    Ontario, Canada
    Posts
    1,731
    Plugin Contributions
    27

    Default Re: Twitch Restrict Categories by Customer or Group

    UPDATE: The last fix in post #8 did not respect the customer_cat_group '0' for 'Everyone'

    Please use this code moving forward:

    // bof Twitch Restrict Categories by Customer or Group
    $sql = "select categories_id, customers_cat_group from " . TABLE_CATEGORIES_CUSTOMERS . " WHERE categories_id = '" . (int)$current_category_id . "'";
    $customer_group = $db->Execute($sql);
    $cust_var = $customer_group->fields['customers_cat_group'];

    if ($cust_var == '0') {
    // do nothing - the category is set for 'Everyone'
    } elseif ($cust_var != $_SESSION['customers_cat_group']) {
    // Not Authorized to see this product/not logged into account
    unset($_GET['products_id']);
    unset($breadcrumb->_trail[sizeof($breadcrumb->_trail)-1]['title']);
    $robotsNoIndex = true;
    header('HTTP/1.1 404 Not Found');
    }
    // eof Twitch Restrict Categories by Customer or Group

    This patch will be included in version 14b when it is released.
    Twitch.
    https://www.twitchtoo.com Do you work for free? Please donate.
    Twitch Base7 with Wholesale PRO - 88 preinstalled plugins zero errors.

  10. #10
    Join Date
    Apr 2007
    Location
    Ontario, Canada
    Posts
    1,731
    Plugin Contributions
    27

    Default Re: Twitch Restrict Categories by Customer or Group

    Twitch Restrict Categories by Customer or Group 14b is complete.

    This version includes both fixes published in this forum:
    Post #5 - Advanced Search Plus 2.0 + Hide Restricted Search Categories w/Twitch Restrict Categories Installed
    Post #8 & #9 - Twitch Restrict Categories by Customer or Group + Inherited Product Restriction


    It also includes a new Master 'customers_cat_group' ID
    The purpose of this update is to allow one master login to access everything regardless of customers_cat_group status on the live site.

    When category is set to customers_cat_group = 1
    - Live Site - Master sees all categories and products in sidebox/category tabs/advanced search

    - Admin - set category to Master 1 and you can restrict category to master only on live site
    - Category status remains unchanged
    - Product status remains unchanged
    - Restriction remains inherited from nearest category
    Twitch.
    https://www.twitchtoo.com Do you work for free? Please donate.
    Twitch Base7 with Wholesale PRO - 88 preinstalled plugins zero errors.

 

 
Page 1 of 10 123 ... LastLast

Similar Threads

  1. Group Pricing - how can I restrict against certain categories?
    By DodgeGirl in forum Setting Up Categories, Products, Attributes
    Replies: 26
    Last Post: 2 Jun 2011, 09:20 PM
  2. How to restrict access for specific categories to registered customer?
    By tutebarra in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 28 Apr 2011, 03:20 PM
  3. Restrict Customer access to certain products or product categories.
    By henryk in forum Managing Customers and Orders
    Replies: 1
    Last Post: 27 Nov 2008, 08:45 AM
  4. Restrict Ordering Process for One Customer / Group
    By blackpig in forum Managing Customers and Orders
    Replies: 3
    Last Post: 17 Jun 2008, 05:15 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR