frank18:
That file is a modified version of the late Conor's file discussed somewhere in the forums (I am sure you are watching us Conor, we owe you so much!)
Much appreciated mate - pls post it here for all to benefit.
Cheers / Frank
/* SQL Uninstall For Zen-Cart 1.5.x */
SET @configuration_group_id=0;
SELECT (@configuration_group_id:=configuration_group_id) FROM configuration_group WHERE configuration_group_title= 'Category Restriction' LIMIT 1;
DELETE FROM configuration WHERE configuration_group_id = @configuration_group_id AND configuration_group_id != 0;
DELETE FROM configuration_group WHERE configuration_group_id = @configuration_group_id AND configuration_group_id != 0;
DELETE FROM configuration WHERE configuration_key = 'CATEGORY_RESTRICTION_HIDEPRICE_CATEGORY';
DELETE FROM configuration WHERE configuration_key = 'CATEGORY_RESTRICTION_LOGIN_CATEGORY';
DELETE FROM configuration WHERE configuration_key = 'CATEGORY_RESTRICTION_LOGIN_MANUFACTURER';
DELETE FROM admin_pages WHERE page_key='csar_regn';
ALTER TABLE `customers` DROP `customers_privileges`;
/* SQL Install For Zen-Cart 1.5.x */
ALTER TABLE `customers` ADD `customers_privileges` INT( 1 ) NOT NULL DEFAULT '0' AFTER `customers_authorization`;
SET @configuration_group_id=0;
SELECT @configuration_group_id:=configuration_group_id
FROM configuration_group
WHERE configuration_group_title= 'Category Restriction'
LIMIT 1;
DELETE FROM configuration WHERE configuration_group_id = @configuration_group_id;
DELETE FROM configuration_group WHERE configuration_group_id = @configuration_group_id;
INSERT INTO configuration_group (configuration_group_id, configuration_group_title, configuration_group_description, sort_order, visible) VALUES (NULL, 'Category Restriction', 'Configure Category Restriction Settings', '1', '1');
SET @configuration_group_id=last_insert_id();
UPDATE configuration_group SET sort_order = @configuration_group_id WHERE configuration_group_id = @configuration_group_id;
INSERT INTO `configuration` (`configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES
(NULL, 'Hide Prices for Specific Categories', 'CATEGORY_RESTRICTION_HIDEPRICE_CATEGORY', '0', 'Restrict product price display for specific categories if the customer is not logged in.<br /><br />Enter the categories ID as a comma delimited list - do not use spaces (eg 12,19,45, 7_45).<br /><br />In this example categories 12, 19 and 45 can be restricted (Because category 45 is a subcategory of category 7 you need to enter both 45 and 7_45).<br />', @configuration_group_id, 1, now(), now(), NULL, NULL),
(NULL, 'Set Categories Requiring Customer To Login', 'CATEGORY_RESTRICTION_LOGIN_CATEGORY', '0', 'Specify products of certain categories which can only be accessed by logged in customers.<br /><br />Enter the categories ID as a comma delimited list - do not use spaces (eg 12,19,28).<br /><br />In this example categories 12, 19 and 28 can be restricted.<br />', @configuration_group_id, 2, now(), now(), NULL, NULL),
(NULL, 'Set Manufacturers Requiring Customer To Login', 'CATEGORY_RESTRICTION_LOGIN_MANUFACTURER', '0', 'Specify manufacturers to be accessed by logged in customers only.<br /><br />Enter the manufacturers ID as a comma delimited list - do not use spaces (eg 1, 5, 6).<br /><br />In this example products of manufacturers IDs 1, 5, 6 can be restricted.<br /><br />The restriction could be to hide prices of certain manufacturers products or it could be used to assign privileged access to manufacturers products.<br />', @configuration_group_id, 3, now(), now(), NULL, NULL);
/* SQL Install For Zen-Cart Admin Pages 1.5.x*/
SELECT @sortorder:=max(sort_order) FROM admin_pages;
INSERT INTO `admin_pages` (`page_key`, `language_key`, `main_page`, `page_params`, `menu_key`, `display_on_menu`, `sort_order`) VALUES
('csar_regn', 'BOX_CONFIGURATION_CATEGORY_RESTRICTION', 'FILENAME_CONFIGURATION',CONCAT('gID=',@configuration_group_id), 'catalog', 'Y', @configuration_group_id);
Cant remember if I saw anything about this in the readme file but: CATEGORY_RESTRICTION_LOGIN_CATEGORY value 0 requires login for all categories. Just a FYI.
Hope this helps!