I edited your text to reflect the changes you mention in page two. Can you update your zip with this text?
Also, If you can explain WHICH occurrence of <!--bof Form close--> to place code under that would be great! There are two there.
This installation includes editing 7 files, installing 1 new file, and applying one SQL patch (a fairly simple one).
1. ADD FILES
Add the file "tpl_category_pass_check.php" to /includes/templates/CUSTOM/templates
######################################################################
2. INSTALL SQL PATCH
BE SURE TO BACKUP YOUR DATABASE BEFORE PROCEEDING
In the admin area, under "Tools -> Install SQL Patches", enter the following query:
ALTER TABLE categories ADD pw varchar(64);
WARNING! This assumes you have not used a prefix when installing your databases. If you did use a prefix, add it before "categories" (ie: prefix_categories)
######################################################################
3. EDIT FILES
If you don't understand the use of CUSTOM in some of the file paths, please read https://www.zen-cart.com/tutorials/index.php?article=36
WARNING! Currently there is no override system for admin files, so some of these files listed are the CORE files. Always do a backup of each file before you edit it.
--------------------------------------------------------------------
FILE: /admin/includes/modules/category_product_listing.php
Find (on or near lines 100 AND 109) There are TWO! Replace them both!:
$categories = $db->Execute("select c.categories_id, cd.categories_name, cd.categories_description, c.categories_image,
c.parent_id, c.sort_order, c.date_added, c.last_modified,
c.categories_status
Replace BOTH with:
$categories = $db->Execute("select c.categories_id, cd.categories_name, cd.categories_description, c.categories_image,
c.parent_id, c.sort_order, c.date_added, c.last_modified,
c.categories_status, c.pw
(Just added ", pw")
-------------------------------------------------------
FILE: /admin/categories.php
Find (on or near line 147):
if (isset($_POST['categories_id'])) $categories_id = zen_db_prepare_input($_POST['categories_id']);
$sort_order = zen_db_prepare_input($_POST['sort_order']);
$sql_data_array = array('sort_order' => (int)$sort_order);
if ($action == 'insert_category') {
$insert_sql_data = array('parent_id' => $current_category_id,
'date_added' => 'now()');
Replace with:
if (isset($_POST['categories_id'])) $categories_id = zen_db_prepare_input($_POST['categories_id']);
if (isset($_POST['categories_pw'])) $categories_pw = zen_db_prepare_input($_POST['categories_pw']);
$sort_order = zen_db_prepare_input($_POST['sort_order']);
$sql_data_array = array('sort_order' => (int)$sort_order);
if ($action == 'insert_category') {
$insert_sql_data = array('parent_id' => $current_category_id,
'date_added' => 'now()',
'pw' => $categories_pw);
Find (on or near line 182):
$update_sql_data = array('last_modified' => 'now()');
Replace with:
$update_sql_data = array('last_modified' => 'now()',
'pw' => $categories_pw);
Find (on or near line 704 AND 758) There are TWO! Replace them both!:
} else {
$category_inputs_string .= zen_draw_textarea_field('categories_description[' . $languages[$i]['id'] . ']', 'soft', '100%', '20', zen_get_category_description($cInfo->categories_id, $languages[$i]['id']));
}
}
Replace BOTH with:
} else {
$category_inputs_string .= zen_draw_textarea_field('categories_description[' . $languages[$i]['id'] . ']', 'soft', '100%', '20', zen_get_category_description($cInfo->categories_id, $languages[$i]['id']));
}
$category_inputs_string .= "<br /><br />" . TEXT_CATEGORIES_PASSWORD . zen_draw_input_field('categories_pw', $cInfo->pw, '', false, 'text', true);
}
----------------------------------------------------
FILE: /admin/includes/languages/english/categories.php
Find (on or near line 214):
define('TEXT_CATEGORIES_DESCRIPTION', 'Categories Description:');
Add the following line underneath it:
define('TEXT_CATEGORIES_PASSWORD', '(If Category Password is filled in, customers will have to enter a password to view/buy products in this category)<br/>Category Password: ');
**Repeat this with any other languages you use.
------------------------------------------------------
FILE: /includes/languages/english/CUSTOM/index.php
Find (on or around line 48):
define('TEXT_ALL_MANUFACTURERS', 'All Manufacturers');
Add the following lines underneath it:
define('CATEGORY_PASS_INVALID', '<h4 style="color: #ff0000;">Invalid Password</h4>');
define('CATEGORY_INSERT_PASSWORD', '<h3>Category Locked</h3><p>For security reasons, this category is password protected. If you haven\'t been given the password, then you are not authorized to view this category.</p><strong>Please enter the password</strong>: ');
**Repeat this with any other languages you use.
------------------------------------------------------
FILE: /includes/languages/english/CUSTOM/product_info.php
Find (on or around line 20):
define('TEXT_PRODUCT_MODEL', 'Model: ');
Add the following lines underneath it:
define('CATEGORY_PASS_INVALID', '<h4 style="color: #ff0000;">Invalid Password</h4>');
define('CATEGORY_INSERT_PASSWORD', '<h3>Category Locked</h3><p>For security reasons, this category is password protected. If you haven\'t been given the password, then you are not authorized to view this category.</p><strong>Please enter the password</strong>: ');
**Repeat this with any other languages you use.
----------------------------------------------------------
FILE: /includes/templates/CUSTOM/templates/tpl_index_product_list.php
Find (on or around line 15):
<div class="centerColumn" id="indexProductList">
Add the following lines underneath it:
<?php
$passed = false;
require($template->get_template_dir('tpl_category_pass_check.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_category_pass_check.php');
if($passed) { //Begin Check for Password
?>
Find (on or around line 208):
} //// eof: categories
Add the following line underneath it:
} //// End Check for Password
-----------------------------------------------------------
FILE: /includes/templates/CUSTOM/templates/tpl_product_info_display.php
Find (on or around line 16):
<div class="centerColumn" id="productGeneral">
Add the following lines underneath it:
<?php
$passed = false;
require($template->get_template_dir('tpl_category_pass_check.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_category_pass_check.php');
if($passed) { //Begin Check for Password
?>
Find (on or around line 244):
<!--bof Form close-->
Add the following line underneath it:
<?php } //End Check for Password ?>


Reply With Quote
