function wpsc_category_name($category_id = null) { if ($category_id < 1) { $category_id = wpsc_category_id(); } $category = get_term_by('id', $category_id, 'wpsc_product_category'); return $category ? $category->name : ''; }
/** * wpsc_category_image function, Gets the category image or returns false * @param integer category ID, can be 0 * @return string url to the category image */ function wpsc_category_image($category_id = null) { if ($category_id < 1) { $category_id = wpsc_category_id(); } $category_image = wpsc_get_categorymeta($category_id, 'image'); $category_path = WPSC_CATEGORY_DIR . basename($category_image); $category_url = WPSC_CATEGORY_URL . basename($category_image); if (file_exists($category_path) && is_file($category_path)) { return $category_url; } return false; }
function etheme_get_categories_menu() { ?> <div class="block cats"> <div class="block-head"> <?php _e('Categories', ETHEME_DOMAIN); ?> </div> <div class="block-content"> <?php $instance_categories = get_terms('wpsc_product_category', 'hide_empty=0&parent=0'); foreach ($instance_categories as $categories) { $term_id = $categories->term_id; $term_name = $categories->name; ?> <div class='categories-group <?php if ($term_id == wpsc_category_id()) { echo 'current-parent opened'; } ?> ' id='sidebar_categorisation_group_<?php echo $term_id; ?> '> <h5 class='wpsc_category_title'><a href="<?php echo get_term_link($categories, 'wpsc_product_category'); ?> "><?php echo $term_name; ?> </a><span class="btn-show"></span></h5> <?php $subcat_args = array('taxonomy' => 'wpsc_product_category', 'title_li' => '', 'show_count' => 0, 'hide_empty' => 0, 'echo' => false, 'show_option_none' => '', 'child_of' => $term_id); ?> <?php if (get_option('show_category_count') == 1) { $subcat_args['show_count'] = 1; } ?> <?php $subcategories = wp_list_categories($subcat_args); ?> <?php if ($subcategories) { ?> <ul class='wpsc_categories wpsc_top_level_categories'><?php echo $subcategories; ?> </ul> <?php } ?> <div class='clear_category_group'></div> </div> <?php } ?> </div> <script type="text/javascript"> <?php if (!etheme_get_option('cats_accordion')) { ?> var nav_accordion = false; <?php } else { ?> var nav_accordion = true; <?php } ?> </script> </div> <?php }