Home › Forums › Basel support forum › Stars and number of reviews always visible with products?
Stars and number of reviews always visible with products?
- This topic has 7 replies, 2 voices, and was last updated 8 years, 3 months ago by Artem Temos.
-
AuthorPosts
-
August 28, 2016 at 8:47 am #3212
Pat84ParticipantHi there, my favourite theme so far! Is there a way to show the review stars everywhere along with the products? At the moment, the only way to see the reviews is on the product page; I would like to have the stars and number of reviews always visible with the products everywhere. Is there a way to do so?
Pat
August 28, 2016 at 5:03 pm #3226
Artem TemosKeymasterHello,
Thank you for contacting our support center.
The problem is that hover effect for products that you use on your web-site doesn’t have rating stars. Try to use another one that you may find in Theme Settings -> Shop. If you still want to use current hover effect you will need to make a small code customization. Write us if you need some instructions.
Regards
August 28, 2016 at 11:06 pm #3241
Pat84ParticipantThanks! I managed to show the stars but I would like to have the number of reviews between parenthesis, something like: 5stars (140)
Is this too complicated to do?
Thanks again 🙂
Pat
August 29, 2016 at 7:56 am #3248
Artem TemosKeymasterWe would be glad to help you but it requires a bit more PHP code customization and we don’t have quick instruction for you about this question.
August 29, 2016 at 10:48 am #3249
Pat84ParticipantI think I should use
$rating_count = $product->get_rating_count();
I found this piece of code too:
<div class="product-ratings"> <?php if ( get_option( 'woocommerce_enable_review_rating' ) === 'no' ) { return; } $rating_count = $product->get_rating_count(); $review_count = $product->get_review_count(); $average = $product->get_average_rating(); if ( $rating_count > 0 ) : ?> <div class="woocommerce-product-rating" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"> <div class="star-rating" title="<?php printf( __( 'Rated %s out of 5', 'woocommerce' ), $average ); ?>"> <span style="width:<?php echo ( ( $average / 5 ) * 100 ); ?>%"> <strong itemprop="ratingValue" class="rating"><?php echo esc_html( $average ); ?></strong> <?php printf( __( 'out of %s5%s', 'woocommerce' ), '<span itemprop="bestRating">', '</span>' ); ?> <?php printf( _n( 'based on %s customer rating', 'based on %s customer ratings', $rating_count, 'woocommerce' ), '<span itemprop="ratingCount" class="rating">' . $rating_count . '</span>' ); ?> </span> </div> <?php if ( comments_open() ) : ?><a href="#reviews" class="woocommerce-review-link" rel="nofollow">(<?php printf( _n( '%s customer review', '%s customer reviews', $review_count, 'woocommerce' ), '<span itemprop="reviewCount" class="count">' . $review_count . '</span>' ); ?>)</a><?php endif ?> </div> <?php endif; ?> </div><!-- .product-ratings -->
As I am not a developer I would not try to place this on my website but I would appreciate if you guys could put me on the right track.
Thanks in advance.
Pat
August 29, 2016 at 3:47 pm #3260
Artem TemosKeymasterOkay, just try to place it some of the content product files
basel/woocommerce/content-product-*.php
depending on what hover effect do you use.August 29, 2016 at 9:40 pm #3279
Pat84ParticipantI like that “just try”. I reckon, if there might be the chance to screw up my website, you should not say “just try”. Is the answer: “Yes, it might work” or “better leave it to the experts”?
Thank you,
Pat
August 30, 2016 at 4:55 am #3285
Artem TemosKeymasterOkay, sorry for that. But is there any difference between “just try” and “it might work”? In both cases, any peace of code possible may throw some warning or fatal error and break your site. And it is impossible to say that it will 100% work fine. But if you place this code to your file via FTP (FileZilla for example) and see that site doesn’t work you can remove your code and return old file just in a few seconds.
Anyway, maybe the best answer to this question will “better leave it to the experts” 🙂
Regards
-
AuthorPosts
Tagged: review count
- You must be logged in to create new topics. Login / Register