Exemple #1
0
     // to make a specific category stand out define a new class in the stylesheet example: A.category-holiday
     // uncomment the select below and set the cPath=3 to the cPath= your_categories_id
     // many variations of this can be done
     //      case ($box_categories_array[$i]['path'] == 'cPath=3'):
     //        $new_style = 'category-holiday';
     //        break;
     case $box_categories_array[$i]['top'] == 'true':
         $new_style = 'category-top';
         break;
     case $box_categories_array[$i]['has_sub_cat']:
         $new_style = 'category-subs';
         break;
     default:
         $new_style = 'category-products';
 }
 if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or $box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1) {
     // skip if this is for the document box (==3)
 } else {
     /*#### Wel*/
     if ($i == 0) {
         $top = '-no-dots-';
     } else {
         $top = '';
     }
     /*	  $content .= '<div class="categories-top-list">';*/
     if ($new_style == 'category-products' || $new_style == 'category-subs') {
         $open_tag = '<div class="subcategory">';
     } else {
         $open_tag = '<div class="categories-top-list ' . $top . '">';
     }
     /*#### /Wel*/
    if ($category['parent_id'] != 0) {
        $box_categories_arr[$category['parent_id']]['children'][$category['categories_id']] = $category;
        if ($category['has_sub_cat'] == 1) {
            $box_categories_arr[$category['categories_id']] = $category;
        }
    } else {
        foreach ($category as $key => $cate) {
            $box_categories_arr[$category['categories_id']][$key] = $cate;
        }
    }
}
foreach ($box_categories_arr as $category) {
    $tmp = array('id' => $category['categories_id'], 'parent_id' => $category['parent_id'], 'name' => $category['name'], 'href' => zen_href_link(FILENAME_DEFAULT, $category['path']), 'top' => $category['top'] == 'true' ? true : false, 'current' => $category['current'], 'has_children' => $category['has_sub_cat'], 'image' => $category['image'], 'type' => zen_get_product_types_to_category($category['path']), 'selected' => $category['categories_id'] == $current_category_id, 'children' => array());
    if (!empty($category['children'])) {
        foreach ($category['children'] as $cate) {
            $tmp['children'][$cate['categories_id']] = array('id' => $cate['categories_id'], 'parent_id' => $cate['parent_id'], 'name' => $cate['name'], 'href' => zen_href_link(FILENAME_DEFAULT, $cate['path']), 'top' => $cate['top'] == 'true' ? true : false, 'current' => $cate['current'], 'has_children' => $cate['has_sub_cat'], 'image' => $cate['image'], 'type' => zen_get_product_types_to_category($cate['path']), 'selected' => $cate['categories_id'] == $current_category_id, 'children' => array());
        }
    }
    if (isset($category['count']) && (CATEGORIES_COUNT_ZERO == '1' && $category['count'] == 0 || $category['count'] > 0)) {
        $tmp['count'] = $category['count'];
    }
    // if (array_key_exists($category['parent_id'], $tpl_categories))
    if ($category['top'] == 'true') {
        $tpl_categories[$category['categories_id']] = $tmp;
    } else {
        $tpl_categories[$category['parent_id']]['children'][$category['categories_id']] = $tmp;
    }
}
foreach ($tpl_categories as $key111 => $tcategories) {
    if (empty($tcategories['id'])) {
        unset($tpl_categories[$key111]);