Skip to content

Commit

Permalink
Fix prepares. Closes woocommerce#1973.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejolley committed Dec 12, 2012
1 parent 6e2b706 commit 7a0c734
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions classes/abstracts/abstract-wc-product.php
Original file line number Diff line number Diff line change
Expand Up @@ -914,15 +914,15 @@ function get_rating_html( $location = '' ) {
AND comment_post_ID = %d
AND comment_approved = '1'
AND meta_value > 0
"), $this->id );
", $this->id ) );

$ratings = $wpdb->get_var( $wpdb->prepare("
SELECT SUM(meta_value) FROM $wpdb->commentmeta
LEFT JOIN $wpdb->comments ON $wpdb->commentmeta.comment_id = $wpdb->comments.comment_ID
WHERE meta_key = 'rating'
AND comment_post_ID = %d
AND comment_approved = '1'
"), $this->id );
", $this->id ) );

if ( $count > 0 )
$average_rating = number_format($ratings / $count, 2);
Expand Down
4 changes: 2 additions & 2 deletions templates/single-product-reviews.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
AND comment_post_ID = %d
AND comment_approved = '1'
AND meta_value > 0
"), $post->ID );
", $post->ID ) );

$rating = $wpdb->get_var( $wpdb->prepare("
SELECT SUM(meta_value) FROM $wpdb->commentmeta
LEFT JOIN $wpdb->comments ON $wpdb->commentmeta.comment_id = $wpdb->comments.comment_ID
WHERE meta_key = 'rating'
AND comment_post_ID = %d
AND comment_approved = '1'
"), $post->ID );
", $post->ID ) );

if ( $count > 0 ) {

Expand Down

0 comments on commit 7a0c734

Please sign in to comment.