hCategories.php

The hCategories.php helper provides a set of functions for handling categories in Osclass. It allows you to retrieve the current category, obtain the list of categories as a hierarchical tree, count total categories and subcategories, and display category selection fields within forms.

Functions Description

osc_category() – Gets current category.

osc_get_categories() – Gets the list of categories as a tree.

osc_field_toTree($item, $field) – If the result of toTree had the same format as items or comments, it would be the same as osc_field.

osc_category_field($field, $locale = '') – Gets the value of the category attribute.

osc_priv_count_categories() – Gets the number of categories.

osc_priv_count_subcategories() – Gets the number of subcategories.

osc_count_categories() – Gets the total of categories.

osc_has_categories() – Indicates if there are more categories in the list. If categories are not loaded, this function will load them.

osc_count_subcategories() – Gets the total number of subcategories for the current category.

osc_has_subcategories() – Indicates if there are more subcategories for the current category in the list.

osc_category_name($locale = '') – Gets the name of the current category.

osc_category_description($locale = '') – Gets the description of the current category.

osc_category_id($locale = '') – Gets the id of the current category.

osc_category_slug($locale = '') – Gets the slug of the current category.

osc_category_total_items() – Gets the total items related with the current category.

osc_goto_first_category() – Resets the pointer of the category array to the first category.

osc_get_non_empty_categories() – Gets the list of non-empty categories.

osc_categories_select($name = 'sCategory', $category = null, $default_str = null) – Prints category select.