forked from JoeyButler/starkers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wpsc-category_widget.php
68 lines (45 loc) · 2.91 KB
/
wpsc-category_widget.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
$curr_cat = get_term( $category_id, 'wpsc_product_category', ARRAY_A );
$category_list = get_terms( 'wpsc_product_category', 'hide_empty=0&parent=' . $category_id );
$link = get_term_link((int)$category_id , 'wpsc_product_category');
$category_image = wpsc_get_categorymeta( $curr_cat['term_id'], 'image' );
$category_image = WPSC_CATEGORY_URL . $category_image;
$show_name = $instance['show_name'];
if ( $grid ) : ?>
<a href="<?php echo esc_url( $link ); ?>" style="padding: 4px 4px 0 0; width:<?php echo $width; ?>px; height:<?php echo $height; ?>px;" title="<?php echo $curr_cat['name']; ?>" class="wpsc_category_grid_item">
<?php wpsc_parent_category_image( $show_thumbnails, $category_image , $width, $height, true ,$show_name); ?>
</a>
<?php wpsc_start_category_query( array( 'parent_category_id' => $category_id, 'show_thumbnails' => $show_thumbnails, 'show_name' => $show_name) ); ?>
<a href="<?php wpsc_print_category_url(); ?>" style="width:<?php echo $width; ?>px; height:<?php echo $height; ?>px" class="wpsc_category_grid_item" title="<?php wpsc_print_category_name(); ?>">
<?php wpsc_print_category_image( $width, $height ); ?>
</a>
<?php wpsc_print_subcategory( '', '' ); ?>
<?php wpsc_end_category_query(); ?>
<?php else : ?>
<div class="wpsc_categorisation_group" id="categorisation_group_<?php echo $category_id; ?>">
<ul class="wpsc_categories wpsc_top_level_categories">
<li class="wpsc_category_<?php echo $curr_cat['term_id']; wpsc_print_category_classes($curr_cat); ?>">
<?php if(! ($category_image == WPSC_CATEGORY_URL) ){ ?>
<a href="<?php echo esc_url( $link ); ?>" class="wpsc_category_image_link"><?php
wpsc_parent_category_image( $show_thumbnails, $category_image , $width, $height, false, $show_name ); ?></a>
<?php } ?>
<a href="<?php echo esc_url( $link ); ?>"><?php echo esc_html( $curr_cat['name'] ); ?></a>
<ul class="wpsc_categories wpsc_second_level_categories">
<?php wpsc_start_category_query( array( 'parent_category_id' => $category_id, 'show_thumbnails' => $show_thumbnails , 'show_name' => $show_name) ); ?>
<li class="wpsc_category_<?php wpsc_print_category_id(); wpsc_print_category_classes_section();?>">
<a href="<?php wpsc_print_category_url(); ?>" class="wpsc_category_image_link">
<?php wpsc_print_category_image( $width, $height ); ?>
</a>
<a href="<?php wpsc_print_category_url(); ?>" class="wpsc_category_link">
<?php wpsc_print_category_name(); ?>
<?php if ( 1 == get_option( 'show_category_count') ) wpsc_print_category_products_count( "(",")" ); ?>
</a>
<?php wpsc_print_subcategory( '<ul>', '</ul>' ); ?>
</li>
<?php wpsc_end_category_query(); ?>
</ul>
</li>
</ul>
<div class="clear_category_group"></div>
</div>
<?php endif; ?>