function drawSubcategory($category) { if (osc_count_subcategories2() > 0) { osc_category_move_to_children(); ?> <ul> <?php while (osc_has_categories()) { ?> <li><a class="category cat_<?php echo osc_category_id(); ?> " href="<?php echo osc_search_category_url(); ?> "><?php echo osc_category_name(); ?> </a> <span>(<?php echo osc_category_total_items(); ?> )</span><?php drawSubcategory(osc_category()); ?> </li> <?php } ?> </ul> <?php osc_category_move_to_parent(); } }
function Subcategory($category) { if (osc_count_subcategories2() > 0) { osc_category_move_to_children(); ?> <div id="cat_<?php echo $category['pk_i_id']; ?> " class="panel-collapse collapse"> <div class="panel-body"> <ul> <?php while (osc_has_categories()) { ?> <?php if (osc_category_total_items() < 1 && nc_osc_hide_categories()) { continue; } ?> <li> <a data-parent="#cat_<?php echo $category['pk_i_id']; ?> " href="<?php echo osc_search_category_url(); ?> "> <?php echo osc_category_name(); ?> </a> <span>(<?php echo osc_category_total_items(); ?> )</span><?php Subcategory(osc_category()); ?> </li> <?php } ?> </ul> </div> </div> <?php osc_category_move_to_parent(); } }
/** * Low level function: Gets the value of the category attribute * * @return <array> */ function osc_category_field($field, $locale = '') { return osc_field_toTree(osc_category(), $field); }
/** * Low level function: Gets the value of the category attribute * * @return <array> */ function osc_category_field($field, $locale = '') { return osc_field(osc_category(), $field, ""); }
/** * Create automatically the url of a category * * @return string the url */ function osc_search_category_url($pattern = '') { $category = osc_category(); $path = ''; if (osc_rewrite_enabled()) { if ($category != '') { $category = Category::newInstance()->hierarchy($category['pk_i_id']); $sanitized_category = ""; for ($i = count($category); $i > 0; $i--) { $sanitized_category .= $category[$i - 1]['s_slug'] . '/'; } $path = osc_base_url() . $sanitized_category; } if ($pattern != '') { if ($path == '') { $path = osc_base_url() . 'search/' . $pattern; } else { $path .= 'search/' . $pattern; } } } else { $path = sprintf(osc_base_url(true) . '?page=search&sCategory=%d', $category['pk_i_id']); } return $path; }
/** * Gets the total items related with the current category * * @return <int> */ function osc_category_total_items() { $category = osc_category(); return CategoryStats::newInstance()->getNumItems($category); }