location added to star rating, so we can have different sizes in sidebar for instance

This commit is contained in:
Mike Jolley 2011-08-28 13:07:33 +01:00
parent 0c11a93c7c
commit c8d0273407
2 changed files with 4 additions and 3 deletions

View File

@ -504,10 +504,11 @@ class woocommerce_product {
}
/** Returns the product rating in html format */
function get_rating_html() {
function get_rating_html( $location = '' ) {
global $wpdb;
$star_size = apply_filters('woocommerce_star_rating_size', 16);
if ($location) $location = '_'.$location;
$star_size = apply_filters('woocommerce_star_rating_size'.$location, 16);
$count = $wpdb->get_var("
SELECT COUNT(meta_value) FROM $wpdb->commentmeta

View File

@ -74,7 +74,7 @@ class WooCommerce_Widget_Top_Rated_Products extends WP_Widget {
<li><a href="<?php echo get_permalink( $top_rated_posts->post->ID ) ?>" title="<?php echo esc_attr($top_rated_posts->post->post_title ? $top_rated_posts->post->post_title : $top_rated_posts->post->ID); ?>">
<?php if (has_post_thumbnail( $top_rated_posts->post->ID )) echo get_the_post_thumbnail($top_rated_posts->post->ID, 'shop_thumbnail'); else echo '<img src="'.woocommerce::plugin_url().'/assets/images/placeholder.png" alt="Placeholder" width="'.woocommerce::get_var('shop_thumbnail_image_width').'px" height="'.woocommerce::get_var('shop_thumbnail_image_height').'px" />'; ?>
<?php if ( $top_rated_posts->post->post_title ) echo get_the_title( $top_rated_posts->post->ID ); else echo $top_rated_posts->post->ID; ?>
</a> <?php echo $_product->get_rating_html(); ?><?php echo $_product->get_price_html(); ?></li>
</a> <?php echo $_product->get_rating_html('sidebar'); ?><?php echo $_product->get_price_html(); ?></li>
<?php endwhile; ?>
</ul>