Example #1
0
</a>

				<?php 
if (wpsc_is_product_on_sale()) {
    ?>
					<span class="wpsc-label wpsc-label-important"><?php 
    echo esc_html_x('Sale', 'sale label', 'wp-e-commerce');
    ?>
</span>
				<?php 
}
?>
			</h2>
			<div class="wpsc-product-price">
				<?php 
if (wpsc_is_product_on_sale()) {
    ?>
					<del class="wpsc-old-price">
						<strong><?php 
    esc_html_e('Old Price', 'wp-e-commerce');
    ?>
:</strong> <span class="wpsc-amount"><?php 
    wpsc_product_original_price();
    ?>
</span>
					</del><br />
					<ins class="wpsc-sale-price">
						<strong><?php 
    esc_html_e('Price', 'wp-e-commerce');
    ?>
:</strong> <span class="wpsc-amount"><?php 
Example #2
0
/**
 * Hook into 'post_class' filter to add custom classes to the current product in the loop.
 *
 * @since 4.0
 * @uses apply_filters() Applies 'wpsc_product_class' filter
 * @uses get_post() Gets the current post object
 * @uses wpsc_is_product_on_sale() Checks to see whether the current product is on sale
 * @uses $wpsc_query Global WPEC query object
 *
 * @param  array  $classes
 * @param  string $class
 * @param  int    $post_id
 * @return array  The filtered class array
 */
function wpsc_filter_product_class($classes, $class, $post_id)
{
    if (is_main_query() && !$post_id) {
        return $classes;
    }
    $post = get_post($post_id);
    if ($post->post_type == 'wpsc-product') {
        global $wp_query;
        $count = isset($wp_query->current_post) ? (int) $wp_query->current_post : 1;
        $classes[] = $count % 2 ? 'even' : 'odd';
        if (wpsc_is_product_on_sale($post_id)) {
            $classes[] = 'wpsc-product-on-sale';
        }
        return apply_filters('wpsc_product_class', $classes, $class, $post_id);
    }
    return $classes;
}