strip not collapse

I built a product review for my store. need help for 2 issues, if any one can help?

  1. the code down here is not good for a product without any review. a product page with no review will not collapse the strip since I do have other reviews for my other products. is there anyway to change the code that can make the strip collapsed if no review on that product.

export function Reviews_ready() {
if ($w(‘#Reviews’).getTotalCount() > 0) {
$w(‘#reviewsStrip’).expand();
}
else {
$w(‘#reviewsStrip’).collapse();
}
}

  1. I have installed related product strip and repeater underneath a product page. when I click on related product to the new product page, the reviews on previous product page will continue to appear on the related product page.

Hi!

Please share a link to your site so one of us, the WixCode team, can inspect it and provide you with a solution.

Doron.

I have changed the way it displays the reviews. I add two buttons, one to expandi reviews and the other to collapse reviews, so the first issue Anyway, I still need help for the second issue. https://www.lunacha.com/product-page/imperial-gold-buds-ripe-pu-erh-2010-spring-tea-cake-jujube-aroma
Here is a product page with a single review on it. When you click on the one of related product, the review is not automatically refreshing on the new product page. Thank you

Hi Quenel!

I’ve looked in your site and couldn’t reproduce the issue you’ve described.
It seems that both in your sandbox collection and live collection you have only 3 reviews and those appear only in the proper product page.
Other product pages displayed the line: “There are no reviews yet”


An issue that I did see in the console is that some of the elements in your repeater are receiving incompatible data (in the following image)


You have some errors in the console that indicates issues with the data that is passed to the repeater.
After looking around, I’ve found out that in your collection “Reviews” under ‘Photo’ which is the field that is connected to one of the objects in this repeater there is no data at all.
Also, the component of the “starmeter rating” is expecting a value between 1 and 5, while one of the items in your collection has the value ‘10’.

Other than that I couldn’t find anything serious or critical but if you encounter anything else or just manage to reproduce the issue with the comments, let me know and try to elaborate on the steps to reproducing it.

Hope it helps.

Doron.

The photo in the reviews database is the photo uploaded by reviewer. What if is reviewer not uploading any photos? Can I add a code that can dismiss the error for a review without a photo?
The starmeter rating is coding to an average rating which that value 10 is the total rating number received per one product stored in the review-stats database. It has to be divided by total count of review of the product to get the average rating.

These errors in the console are not crucial for the site’s activity.
They won’t effect the user experience, but, if you’d like to create a common ground for all users reviews you can always have a default image to take place if no image was uploaded by the user.

Doron.