Re: Remove Subcategories Listing Page
This should determine whether there are more subcats:
($this->data[$category_id]) will be true (have content) if the current cat has subs, or false (blank) if not. Use it in a ternary operator similar to the above
PHP Code:
function buildBranch($parent_id, $level, $submenu=true, $parent_link='')
{
$result = sprintf($this->parent_group_start_string, ($submenu==true) ? ' class="level'. ($level+1) . '"' : '' );
if (($this->data[$parent_id])) {
foreach($this->data[$parent_id] as $category_id => $category) {
$category_link = $parent_link . $category_id;
if (($this->data[$category_id])) {
$result .= sprintf($this->child_start_string, ($submenu==true) ? ' class="submenu"' : '');
} else {
$result .= sprintf($this->child_start_string, '');
}
//$result .= str_repeat($this->spacer_string, $this->spacer_multiplier * 1) . '<a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . $category_link) . '">';
$result .= str_repeat($this->spacer_string, $this->spacer_multiplier * 1) . (($this->data[$category_id])? '': '<a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . $category_link) . '">');
$result .= $category['name'];
//$result .= '</a>';
$result .= (($this->data[$category_id])? '': '</a>');
if (($this->data[$category_id]) && (($this->max_level == '0') || ($this->max_level > $level+1))) {
$result .= $this->buildBranch($category_id, $level+1, $submenu, $category_link . '_');
}
$result .= $this->child_end_string;
}
}
$result .= $this->parent_group_end_string;
return $result;
}
(($this->data[$category_id])? '': '<a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . $category_link) . '">')
(($this->data[$category_id])? '': '</a>')
This should allow links only for cats with products, not with subcats.