Example #1
0
/**
 * Body Class Filter
 * @modified:     2009-10-14 by Ben
 * @description:  Adds additional wpsc classes to the body tag.
 * @param:        $classes = Array of body classes
 * @return:       (Array) of classes
 *
 * @uses get_permalink()                Returns WP permalink given post_id
 * @uses get_option()                   Returns option value given key
 * @uses get_post_type()                Returns string for registered post_type name
 * @uses wpsc_is_single_product()       Returns true if we are on a single product
 * @uses wpsc_is_in_category()          Returns true if we are on a WPSC product cat
 * @uses wpsc_is_in_tag()               Returns true if we are on a WPSC product tag
 * @usse esc_attr()                     Keeping things safe just in case
 */
function wpsc_body_class($classes)
{
    global $wp_query, $wpsc_query;
    $post_id = get_the_ID();
    if ($post_id) {
        $page_url = get_permalink($post_id);
        // If on a product or category page...
        if (get_option('product_list_url') == $page_url || get_post_type($post_id) === 'wpsc-product') {
            $classes[] = 'wp-e-commerce';
            if (!is_array($wpsc_query->query)) {
                $classes[] = 'wpsc-home';
            }
            if (wpsc_is_single_product()) {
                $object = $wp_query->get_queried_object();
                $classes[] = 'wpsc-single-product';
                if (absint($object->ID) > 0) {
                    $classes[] = 'wpsc-single-product-' . absint($object->ID);
                }
            }
            if (wpsc_is_in_category() && !wpsc_is_single_product()) {
                $classes[] = 'wpsc-category';
                $tax_object = $wp_query->get_queried_object();
                $classes[] = 'wpsc-category-' . esc_attr($tax_object->slug);
            }
            if (wpsc_is_in_tag() && !wpsc_is_single_product()) {
                $classes[] = 'wpsc-tag';
                $tax_object = $wp_query->get_queried_object();
                $classes[] = 'wpsc-tag-' . esc_attr($tax_object->slug);
            }
        }
        // If viewing the shopping cart...
        if (get_option('shopping_cart_url') == $page_url) {
            $classes[] = 'wp-e-commerce';
            $classes[] = 'wpsc-shopping-cart';
        }
        // If viewing the transaction...
        if (get_option('transact_url') == $page_url) {
            $classes[] = 'wp-e-commerce';
            $classes[] = 'wpsc-transaction-details';
        }
        // If viewing your account...
        if (get_option('user_account_url') == $page_url) {
            $classes[] = 'wp-e-commerce';
            $classes[] = 'wpsc-user-account';
        }
    }
    return $classes;
}
							<?php if(get_option('wpsc_category_description')) :?>
								<?php wpsc_print_category_description("<div class='wpsc_subcategory'>", "</div>"); ?>				
							<?php endif;?>
							
							<?php wpsc_print_subcategory("<ul>", "</ul>"); ?>
						</li>
				<?php wpsc_end_category_query(); ?>
			</ul>
		<?php endif; ?>
	<?php endif; ?>



	
	<?php if(wpsc_display_products()): ?>
		<?php if(wpsc_is_in_category()) : ?>
			<div class='wpsc_category_details'>
				<?php if(get_option('show_category_thumbnails') && wpsc_category_image()) : ?>
					<img src='<?php echo wpsc_category_image(); ?>' alt='<?php echo wpsc_category_name(); ?>' title='<?php echo wpsc_category_name(); ?>' />
				<?php endif; ?>
				
				<?php if(get_option('wpsc_category_description') &&  wpsc_category_description()) : ?>
					<?php echo wpsc_category_description(); ?>
				<?php endif; ?>
			</div>
		<?php endif; ?>
		
		
		<!-- Start Pagination -->
		<?php if ( ( get_option( 'use_pagination' ) == 1 && ( get_option( 'wpsc_page_number_position' ) == 1 || get_option( 'wpsc_page_number_position' ) == 3 ) ) ) : ?>
			<div class="wpsc_page_numbers">
        ?>
			</ul>
		<?php 
    }
    ?>
	<?php 
}
// */
?>

	<?php 
if (wpsc_display_products()) {
    ?>

		<?php 
    if (wpsc_is_in_category()) {
        ?>
			<div class="wpsc_category_details">
				<?php 
        if (wpsc_show_category_thumbnails()) {
            ?>
					<img src="<?php 
            echo wpsc_category_image();
            ?>
" alt="<?php 
            echo wpsc_category_name();
            ?>
" />
				<?php 
        }
        ?>
Example #4
0
/**
 * Body Class Filter
 * @modified:     2009-10-14 by Ben
 * @description:  Adds additional wpsc classes to the body tag.
 * @param:        $classes = Array of body classes
 * @return:       (Array) of classes
 */
function wpsc_body_class($classes)
{
    global $wp_query, $wpsc_query;
    $post_id = $wp_query->post->ID;
    $page_url = get_permalink($post_id);
    // If on a product or category page...
    if (get_option('product_list_url') == $page_url) {
        $classes[] = 'wpsc';
        if (!is_array($wpsc_query->query)) {
            $classes[] = 'wpsc-home';
        }
        if (wpsc_is_single_product()) {
            $classes[] = 'wpsc-single-product';
            if (absint($wpsc_query->products[0]['id']) > 0) {
                $classes[] = 'wpsc-single-product-' . $wpsc_query->products[0]['id'];
            }
        }
        if (wpsc_is_in_category() && !wpsc_is_single_product()) {
            $classes[] = 'wpsc-category';
        }
        if (absint($wpsc_query->query_vars['category_id']) > 0) {
            $classes[] = 'wpsc-category-' . $wpsc_query->query_vars['category_id'];
        }
        if (absint(wpsc_category_group()) > 0) {
            $classes[] = 'wpsc-group-' . wpsc_category_group();
        }
    }
    // If viewing the shopping cart...
    if (get_option('shopping_cart_url') == $page_url) {
        $classes[] = 'wpsc';
        $classes[] = 'wpsc-shopping-cart';
    }
    // If viewing the transaction...
    if (get_option('transact_url') == $page_url) {
        $classes[] = 'wpsc';
        $classes[] = 'wpsc-transaction-details';
    }
    // If viewing your account...
    if (get_option('user_account_url') == $page_url) {
        $classes[] = 'wpsc';
        $classes[] = 'wpsc-user-account';
    }
    return $classes;
}
 public function add_category_page_bottom_elements()
 {
     if (wpsc_is_in_category()) {
         $default_element_ids = array('productcategory-retargeting-2');
         $element_ids = apply_filters('wpecnt_add_category_page_bottom_elements', $default_element_ids);
         if (is_array($element_ids) && !empty($element_ids)) {
             $this->render('retargeting-elements', array('element_ids' => $element_ids));
         }
     }
 }