Re: hideCategories

Originally Posted by
niccol
admin/categories.php
The most recent version of this addon still contains the line ;
Code:
require(DIR_WS_MODULES . 'prod_cat_header_code.php');
I don't think recent versions (>= 1.5.6) of Zen have that file.
Attached is a version of categories.php that is working for me at the moment. Just a hacked together version of previous code in a way that doesn't conflict. Still developing the site so I guess I may come up with other glitches.
I am running 1.5.7c and installed the downloaded ZIP files. All worked fine and I could make an existing Category hidden. However, when I tried to create a new category I got an error at the bottom of the page saying:
WARNING: An Error occurred, please refresh the page and try again.If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.
The error in my log is:
PHP Fatal error: 1064:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 1' at line 4 :: select visibility_status
FROM zen_hide_categories
WHERE categories_id =
LIMIT 1 ==> (as called by) on line 419 <== in /home/www/mysite.org/store/includes/classes/db/mysql/query_factory.php on line 170.
Since I had downloaded the revised CATEGORIES.PHP mentioned in this post, I sent NICCOL a message and he replied with the following suggestion (which appears to have solved the problem).
=====
Try replacing this:
Code:
//Begin hideCategories code
$sql = "select visibility_status
FROM " . TABLE_HIDE_CATEGORIES . "
WHERE categories_id = " . $cInfo->categories_id . "
LIMIT 1";
$hide_status = $db->Execute($sql);
switch ($hide_status->fields['visibility_status']) {
case 1:
$hide_category_normal = false;
$hide_category_nomenu = true;
$hide_category_hidden = false;
break;
case 2:
$hide_category_normal = false;
$hide_category_nomenu = false;
$hide_category_hidden = true;
break;
default:
$hide_category_normal = true;
$hide_category_nomenu = false;
$hide_category_hidden = false;
break;
}
With this:
Code:
if($cInfo->categories_id > 0) {
$sql = "select visibility_status
FROM " . TABLE_HIDE_CATEGORIES . "
WHERE categories_id = " . $cInfo->categories_id . "
LIMIT 1";
$hide_status = $db->Execute($sql);
switch ($hide_status->fields['visibility_status']) {
case 1:
$hide_category_normal = false;
$hide_category_nomenu = true;
$hide_category_hidden = false;
break;
case 2:
$hide_category_normal = false;
$hide_category_nomenu = false;
$hide_category_hidden = true;
break;
default:
$hide_category_normal = true;
$hide_category_nomenu = false;
$hide_category_hidden = false;
break;
}
}
Last edited by mshultise; 24 Jun 2021 at 08:16 AM.
Aloha from Hawaii! (its a dirty job, but SOMEBODY has to live here...)
Bookmarks