Well, as I said, that was just a example to link the first category to the last.
Ex: 36_34_56 ( 36 will link to 56)
But I only tested with one product with a similar categories structure.
If you remove that piece of code and everything is ok again, well, something is wrong inside that while loop.
However, more or less, that's the process needed. This has some comments.
Try to check that $subcategories_array with a print_r($subcategories_array) , or using a die(), to debug.
Or maybe I did somthing wrong, but I can't test it write now.... and I don't have 24000 products to list
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(); // this is gathering all subcategories in a array
// using zen_get_subcategories
zen_get_subcategories($subcategories_array, $categories_tab->fields['categories_id']);
if (!empty($subcategories_array)) { // if there is a subcat
// create a new path ex: 36_35_54 , so it will link to the last subcat found
$path = $categories_tab->fields['categories_id'] . '_' . implode('_', $subcategories_array);
}
}
// create link to according to the path
$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();
}
Bookmarks