Hi Guys,
Hide Categories is just what we need to be able to manage the update of huge numbers of products from multiple vendors and hide new categories while they are being worked on. I see that several sideboxes have been fixed so that hide categories will work with them. I need to try to make it work with the CSS dropdown menu and the CSS flyout menu.
After looking the files up and down, I have determined that the file in classes called category_ul_generator.php (which is used by both mods) is where the hide categories code should be inserted, but I am having a hard time getting it to work.
The file appears to run through the list of categories from the database in a while loop. A series of conditionals determines whether it is a upper listing or a list item, then it builds a list with the ul and li tags programmatically inserted.
I guess I need to rewrite the existing query to the database:
function zen_categories_ul_generator() {
global $languages_id, $db, $request_type;
$this->server = ((ENABLE_SSL == true && $request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER);
$this->base_href = ((ENABLE_SSL == true && $request_type == 'SSL') ? DIR_WS_HTTPS_CATALOG : DIR_WS_CATALOG);
$this->data = array();
$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);
To indclude the info requested by the hide categories query:
list($nada, $mycpath)= split('=', $box_categories_array[$i]['path']);
$mycid = split('_', $mycpath);
$categories_id = array_pop($mycid);
$hide_status = $db->Execute("select visibility_status
FROM " . TABLE_HIDE_CATEGORIES . "
WHERE categories_id = " . $categories_id . "
LIMIT 1");
so it gets all the information for each category at one time.
Then insert a conditional in this while loop that causes it to skip any hidden category or category whose parent is hidden.
while (!$categories->EOF) {
$products_in_category = (SHOW_COUNTS == 'true' ? zen_count_products_in_category($categories->fields['categories_id']) : 0);
$this->data[$categories->fields['parent_id']][$categories->fields['categories_id']] = array('name' => $categories->fields['categories_name'], 'count' => $products_in_category);
$categories->MoveNext();
}
if ($hide_status->fields['visibility_status'] < 1) {
I've tried to do this but am not knowledgable enough to get it right. Please help.
Adowty
Bookmarks