Zen Cart Logo
Forums / All Other Contributions/Addons / Twitch Restrict Categories by Customer or Group

Twitch Restrict Categories by Customer or Group

Views: 25,391

Results 81 to 96 of 96
16 Jan 2018, 5:13 PM
#81
digitalshadow avatar

digitalshadow

Totally Zenned

Join Date:
Mar 2009
Posts:
616
Plugin Contributions:
0

Twitch Restrict Categories by Customer or Group

Is this something you can add to the base code or are you doing this as a custom job?

16 Jan 2018, 6:00 PM
#82
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: Twitch Restrict Categories by Customer or Group

DigitalShadow:

Is this something you can add to the base code or are you doing this as a custom job?

This would be a custom job. Ideally in the future I'd love to have 'insertion switches' in admin where you could control where various access points become available!

19 May 2018, 5:27 PM
#83
marcopolo avatar

marcopolo

Totally Zenned

Join Date:
May 2008
Location:
United States
Posts:
522
Plugin Contributions:
2

Re: Twitch Restrict Categories by Customer or Group

Has anyone gotten this to work with drop down menus? If you did can you please post the before and after code you used to filter out the restricted categories?

19 May 2018, 7:07 PM
#84
marcopolo avatar

marcopolo

Totally Zenned

Join Date:
May 2008
Location:
United States
Posts:
522
Plugin Contributions:
2

Re: Twitch Restrict Categories by Customer or Group

Ok I was able to figure it out myself but if there are any coders that verify my code that would be appreciated.

I modified the following file to get it to work with module "CSS Flyout Menu" /includes/classes/categories_ul_generator.php

Before:

        $categories_query = "select c.categories_id, cd.categories_name, c.parent_id
										from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd
										where c.categories_id = cd.categories_id
										and c.categories_status=1 " .
        								" and cd.language_id = '" . (int)$_SESSION['languages_id'] . "' " .
        								" order by c.parent_id, c.sort_order, cd.categories_name";
        $categories = $db->Execute($categories_query);

After:

        $categories_query = "select c.categories_id, cd.categories_name, c.parent_id
										from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_CUSTOMERS . " ccu, " . TABLE_CATEGORIES_DESCRIPTION . " cd
										where c.categories_id = cd.categories_id
										and c.categories_status=1 " .
										" 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' )
										  order by c.parent_id, c.sort_order, cd.categories_name";

        $categories = $db->Execute($categories_query);
22 May 2018, 4:28 PM
#85
mattys avatar

mattys

Zen Follower

Join Date:
Sep 2006
Location:
North Devon, England, UK
Posts:
289
Plugin Contributions:
0

Re: Twitch Restrict Categories by Customer or Group

Any thoughts on getting this working on zencart 1.5.5?

4 Jun 2018, 3:34 PM
#86
IDEASLady avatar

IDEASLady

Totally Zenned

Join Date:
Aug 2005
Location:
Trujillo Alto, Puerto Rico
Posts:
1,440
Plugin Contributions:
3

Re: Twitch Restrict Categories by Customer or Group

This module is working great but I'm having an issue on all the product pages (products_all, products_new, specials, featured_products). After doing the following adjustment to the header_php.php file (as instructions):

*****
includes/modules/pages/products_all/header_php.php
*****
change lines 23 - 34 from this:
  $products_all_query_raw = "SELECT p.products_type, p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id,
                                    p.products_date_added, m.manufacturers_name, p.products_model, p.products_quantity, p.products_weight, p.product_is_call,
                                    p.product_is_always_free_shipping, p.products_qty_box_status,
                                    p.master_categories_id
                             FROM " . TABLE_PRODUCTS . " p
                             LEFT JOIN " . TABLE_MANUFACTURERS . " m ON (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd
                             WHERE p.products_status = 1
                             AND p.products_id = pd.products_id
                             AND pd.language_id = :languageID " . $order_by;

  $products_all_query_raw = $db->bindVars($products_all_query_raw, ':languageID', $_SESSION['languages_id'], 'integer');
  $products_all_split = new splitPageResults($products_all_query_raw, MAX_DISPLAY_PRODUCTS_ALL);
  
// bof dynamic filter 1 of 1
  include(DIR_WS_MODULES . zen_get_module_directory(FILENAME_DYNAMIC_FILTER));

  $listing_sql = "SELECT DISTINCT p.products_type, p.products_id, pd.products_name, p.products_image, p.products_price,
   p.products_tax_class_id, p.products_date_added, m.manufacturers_name, p.products_model, p.products_quantity, p.products_weight,
   p.product_is_call, p.product_is_always_free_shipping, p.products_qty_box_status, p.master_categories_id, m.manufacturers_id";

  $listing_sql .= " FROM " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_MANUFACTURERS . " m ON (p.manufacturers_id = m.manufacturers_id)" .
   " left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on p.products_id = p2c.products_id" .
   " left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id" .
   ($filter_attr == true ? " join " . TABLE_PRODUCTS_ATTRIBUTES . " p2a on p.products_id = p2a.products_id" .
   " join " . TABLE_PRODUCTS_OPTIONS . " po on p2a.options_id = po.products_options_id" .
   " join " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov on p2a.options_values_id = pov.products_options_values_id" .
   (defined('TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK') ? " join " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " p2as on p.products_id = p2as.products_id " : "") : '');

  $listing_sql .= " WHERE p.products_status = 1 AND (p.products_date_available IS NULL OR p.products_date_available <= current_date) AND pd.language_id = :languageID " .
   $filter . " GROUP BY p.products_id " . $having . $order_by;

  $listing_sql = $db->bindVars($listing_sql, ':languageID', $_SESSION['languages_id'], 'integer');
  $products_all_split = new splitPageResults($listing_sql, MAX_DISPLAY_PRODUCTS_ALL);
// eof dynamic filter 1 of 1  


to this:
  $products_all_query_raw = "SELECT p.products_type, p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id,
                                    p.products_date_added, m.manufacturers_name, p.products_model, p.products_quantity, p.products_weight, p.product_is_call,
                                    p.product_is_always_free_shipping, p.products_qty_box_status,
                                    p.master_categories_id
                             FROM " . TABLE_PRODUCTS . " p
                             LEFT JOIN " . TABLE_MANUFACTURERS . " m ON (p.manufacturers_id = m.manufacturers_id), 
							 "
								. TABLE_PRODUCTS_TO_CATEGORIES . " p2c
                                LEFT JOIN " . TABLE_CATEGORIES_CUSTOMERS . " ccu 
								on p2c.categories_id = ccu.categories_id, 
								
							 " . TABLE_PRODUCTS_DESCRIPTION . " pd
                             WHERE p.products_status = 1
                             AND p.products_id = pd.products_id
                             AND pd.language_id = :languageID 
               AND p.products_id = p2c.products_id
               AND p2c.categories_id = ccu.categories_id
			   AND (ccu.customers_cat_group = '" . (int)$_SESSION['customers_cat_group'] . "' OR ccu.customers_cat_group = '0' )
							 " . $order_by;

  $products_all_query_raw = $db->bindVars($products_all_query_raw, ':languageID', $_SESSION['languages_id'], 'integer');
  $products_all_split = new splitPageResults($products_all_query_raw, MAX_DISPLAY_PRODUCTS_ALL);

The pages start to do few things incorrect:
-displays incorrect number of items listed (instead of decreasing the number this one goes up from 635 to 666);
-repeats items (I think this is why it increases the number of items);
-messes up the styling of the pages (very bad), this is probably the easiest issue of all to fix since it could be related to the template's grid and css.

That file section (and the other product pages headers) was already altered to this:

// bof dynamic filter 1 of 1
  include(DIR_WS_MODULES . zen_get_module_directory(FILENAME_DYNAMIC_FILTER));

  $listing_sql = "SELECT DISTINCT p.products_type, p.products_id, pd.products_name, p.products_image, p.products_price,
   p.products_tax_class_id, p.products_date_added, m.manufacturers_name, p.products_model, p.products_quantity, p.products_weight,
   p.product_is_call, p.product_is_always_free_shipping, p.products_qty_box_status, p.master_categories_id, m.manufacturers_id";

  $listing_sql .= " FROM " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_MANUFACTURERS . " m ON (p.manufacturers_id = m.manufacturers_id)" .
   " left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on p.products_id = p2c.products_id" .
   " left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id" .
   ($filter_attr == true ? " join " . TABLE_PRODUCTS_ATTRIBUTES . " p2a on p.products_id = p2a.products_id" .
   " join " . TABLE_PRODUCTS_OPTIONS . " po on p2a.options_id = po.products_options_id" .
   " join " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov on p2a.options_values_id = pov.products_options_values_id" .
   (defined('TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK') ? " join " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " p2as on p.products_id = p2as.products_id " : "") : '');

  $listing_sql .= " WHERE p.products_status = 1 AND (p.products_date_available IS NULL OR p.products_date_available <= current_date) AND pd.language_id = :languageID " .
   $filter . " GROUP BY p.products_id " . $having . $order_by;

  $listing_sql = $db->bindVars($listing_sql, ':languageID', $_SESSION['languages_id'], 'integer');
  $products_all_split = new splitPageResults($listing_sql, MAX_DISPLAY_PRODUCTS_ALL);
// eof dynamic filter 1 of 1

Please, let me know how I am supposed to change this portion for it to work properly.

22 Sep 2018, 3:10 AM
#87
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: Twitch Restrict Categories by Customer or Group

ideasgirl what version of ZC and template are you working with?

22 Sep 2018, 3:14 AM
#88
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: Twitch Restrict Categories by Customer or Group

mattys:

Any thoughts on getting this working on zencart 1.5.5?

1.55f - Yes.

22 Sep 2018, 3:20 AM
#89
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: Twitch Restrict Categories by Customer or Group

marcopolo:

Has anyone gotten this to work with drop down menus? If you did can you please post the before and after code you used to filter out the restricted categories?
First, I would need to see the code for the drop down you speak of.

Second, most of the existing filters will work but may need to be customized to work with your particular menu code.

28 Sep 2018, 3:23 PM
#90
IDEASLady avatar

IDEASLady

Totally Zenned

Join Date:
Aug 2005
Location:
Trujillo Alto, Puerto Rico
Posts:
1,440
Plugin Contributions:
3

Re: Twitch Restrict Categories by Customer or Group

twitchtoo:

ideasgirl what version of ZC and template are you working with?
1.5.5f

The issues were solved.

5 Jan 2020, 6:09 PM
#91
nishajh avatar

nishajh

Zen Follower

Join Date:
May 2009
Posts:
105
Plugin Contributions:
0

Re: Twitch Restrict Categories by Customer or Group

Thank you for the great add-on.

I have having an issue with the new product & featured page. I have set up as a single product linked to multiple categories. For example if an item 1TW is linked to 3 categories and if I set it item a featured then I see that on the featured page this item is displayed three times. The page works fine if the item is only set to one category.
After looking in to the codes( I am not a good programmer) found that includes/pages/featured/header_php.php has the code. How do I make change in the query to take only one one row instead of three rows from TABLE_PRODUCTS_TO_CATEGORIES?

$featured_products_query_raw = "SELECT p.products_id, p.products_type, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id,
p.products_date_added, m.manufacturers_name, p.products_model, p.products_quantity, p.products_weight, p.product_is_call, p.product_is_always_free_shipping,
p.products_qty_box_status, p.master_categories_id
FROM ("
. TABLE_PRODUCTS . " p
LEFT JOIN " . TABLE_MANUFACTURERS . " m
on (p.manufacturers_id = m.manufacturers_id),
"
. TABLE_PRODUCTS_DESCRIPTION . " pd
LEFT JOIN " . TABLE_FEATURED . " f
on pd.products_id = f.products_id,
"
. TABLE_PRODUCTS_TO_CATEGORIES . " p2c
LEFT JOIN " . TABLE_CATEGORIES_CUSTOMERS . " ccu
on p2c.categories_id = ccu.categories_id

							)
                            WHERE p.products_status = 1 
							and p.products_id = f.products_id 
							and f.status = 1
                            AND p.products_id = pd.products_id 
							and pd.language_id = :languagesID 
           AND p.products_id = p2c.products_id
           
		   AND (ccu.customers_cat_group = '" . (int)$_SESSION['customers_cat_group'] . "' OR ccu.customers_cat_group = '0' )

							" . $order_by;

Thanks so much for any help!

13 Oct 2020, 11:01 AM
#92
elemi avatar

elemi

Zen Follower

Join Date:
Mar 2006
Location:
Auckland, New Zealand
Posts:
242
Plugin Contributions:
0

Re: Twitch Restrict Categories by Customer or Group

Just wondering if this module is being upgraded to 1.5.7? :-)

10 Feb 2021, 12:37 PM
#93
jsarwar avatar

jsarwar

Zen Follower

Join Date:
Jul 2012
Posts:
347
Plugin Contributions:
0

Re: Twitch Restrict Categories by Customer or Group

This is not working for 1.5.6. In admin/categories.php file codes are very different. Do you have updated version of this?

7 May 2021, 5:54 PM
#94
helenewallis avatar

helenewallis

Totally Zenned

Join Date:
Jun 2016
Location:
Suffolk VA
Posts:
625
Plugin Contributions:
0

Re: Twitch Restrict Categories by Customer or Group

Here's another person who would really like this to work with 1.5.6 and up.

31 Aug 2021, 1:28 PM
#95
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: Twitch Restrict Categories by Customer or Group

This module is being included in the next release of Twitch Wholesale PRO Public/Commercial for ZC 1.56c as the Twitch Bridge Matrix now handles product and category level relationships with customer groups using the new wsPRO Manager in Admin.

Release is pending imminently for Zen Cart 1.56c and will be next on the list for development into ZC 1.57c when funding/donations afford it.

Thanks for your support!

11 Sep 2021, 6:06 AM
#96
nishajh avatar

nishajh

Zen Follower

Join Date:
May 2009
Posts:
105
Plugin Contributions:
0

Re: Twitch Restrict Categories by Customer or Group

Thank you for the great mod.

I am having an issue with this module in the mobile version.
1)
The sidebox categories box displays all the categories if a customer is not logged in. I want to hide the sidebox category when the customer is not logged in on mobile. Works fine on the Desktop version.

  1. In the mobile version It shows all the categories when a customer is logged in ( means it is not hiding some categories based on the category group of the customer). Does not show the products through but shows category names and this defeats the purpose of hiding categories

Did anyone solve this issue? I have picture attached to show this. The first two categories are only for a specific group.Attachment 19713

Thanks