So, basically, you want to link to the last subcat no matter what ?
That would be in your:
\zencart\includes\modules\categories_tabs.php ( I've checked on zc 156)
Just for test purposes, try this. At least will give you an idea.
This is for the top tab category list
If cpath is not set it will link to the last child.
If is set, it will link to the top category ( I guess ... didn't test all )
that $subcategories_array has the child's categories ID.
Maybe this works, if you follow the same category configuration.
PHP Code:
while (!$categories_tab->EOF) {
$path = $categories_tab->fields['categories_id'];
// currently selected category
if ((int) $cPath == $categories_tab->fields['categories_id']) {
$new_style = 'category-top';
$categories_tab_current = '<span class="category-subs-selected">' . $categories_tab->fields['categories_name'] . '</span>';
} else {
$new_style = 'category-top';
$categories_tab_current = $categories_tab->fields['categories_name'];
$subcategories_array = array();
zen_get_subcategories($subcategories_array, $categories_tab->fields['categories_id']);
if (!empty($subcategories_array)) {
$path = $categories_tab->fields['categories_id'] . '_' . implode('_', $subcategories_array);
}
}
// create link to top level category
$links_list[] = '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . $path) . '">' . $categories_tab_current . '</a> ';
//$links_list[] = '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . (int)$categories_tab->fields['categories_id']) . '">' . $categories_tab_current . '</a> ';
$categories_tab->MoveNext();
}
And ofcourse , as always, probably there is a better way
Bookmarks