'; $count = $wpdb->get_var(" SELECT COUNT(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 = $post->ID AND comment_approved = '1' AND meta_value > 0 "); $rating = $wpdb->get_var(" 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 = $post->ID AND comment_approved = '1' "); if ( $count>0 ) : $average = number_format($rating / $count, 2); echo '
'; echo '
'.$average.' '.__('out of 5', 'jigoshop').'
'; echo '

'.sprintf( _n('%s review for %s', '%s reviews for %s', $count, 'jigoshop'), ''.$count.'', ''.wptexturize($post->post_title).'' ).'

'; echo '
'; else : echo '

'.__('Reviews', 'jigoshop').'

'; endif; $title_reply = ''; if ( have_comments() ) : echo '
    '; wp_list_comments( array( 'callback' => 'jigoshop_comments' ) ); echo '
'; if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?> '.__('Add Review', 'jigoshop').'

'; $title_reply = __('Add a review', 'jigoshop'); else : $title_reply = __('Be the first to review ', 'jigoshop').'“'.$post->post_title.'”'; echo '

'.__('There are no reviews yet, would you like to submit yours?', 'jigoshop').'

'; endif; $commenter = wp_get_current_commenter(); echo '
'; comment_form(array( 'title_reply' => $title_reply, 'comment_notes_before' => '', 'comment_notes_after' => '', 'fields' => array( 'author' => '

' . ' ' . '*' . '

', 'email' => '', ), 'label_submit' => __('Submit Review', 'jigoshop'), 'logged_in_as' => '', 'comment_field' => '

' . jigoshop::nonce_field('comment_rating', true, false) )); echo '
'; ?>