I spent the day working on the Wix Code, I created the wish list, related products but I grabbed trying to set up the review, I tried, I made all the changes until my brain toasting. Could someone from the Wix team help me?
This is the product page code. Here it does not open lightbox and does not show messages on the page. As I can not get the product ID so I can not check if the form will upload the review and I did not forget to call the window, nor the data base just did not put it here because I just managed to paste the piece I used the elements of the site, the rest I had to cut because it got big and I was not able to post
export function addReview_onClick(event) {
let productId = $w(β#productPageβ).getProduct();
wixWindow.openLightbox(βResenhasβ, {id: productId});
}
function loadReviews(limit) {
let productReview = $w(β#productPageβ).getProduct();
wixData.query(βreviewsβ)
.eq(βproductIdβ, productReview._id)
.find()
.then(res => {
if (res.length > 0) {
renderRating(res.items);
renderReviews(res.items, limit);
$w(β#numberOfReviewsβ).text = ${res.length} Reviews
;
$w(β#numberOfReviewsβ).show();
if (res.length > 2) {
$w(β#seeAllReviewsβ).show();
$w(β#seeAllLineβ).show();
}
}
else {
$w(β#ratingβ).hide();
$w(β#numberOfReviewsβ).text = βEste produto ainda nΓ£o fio avaliado seja o primeiro.β;
$w(β#numberOfReviewsβ).show();
}
});
}
let rating = Math.round(stats.sum * 2 / stats.count) / 2;
$w(β#ratingβ).show();
// setting the rating as HTML to have fine grained control over the formatting
$w(β#ratingβ).html = `
<span
if (odd.length > 0) {
let oddRendered = odd.map(renderReview).join(reviewSeparator) + reviewEnd;
$w(β#reviewsOddβ).html = oddRendered;
$w(β#reviewsOddβ).show();
$w(β#oddReviewContainerβ).show();
}
else {
$w(β#reviewsOddβ).hide();
$w(β#oddReviewContainerβ).hide();
}
if (even.length > 0) {
let evenRendered = even.map(renderReview).join(reviewSeparator) + reviewEnd;
$w(β#reviewsEvenβ).html = evenRendered;
$w(β#reviewsEvenβ).show();
$w(β#evenReviewContainerβ).show();
}
else {
$w(β#reviewsEvenβ).hide();
$w(β#evenReviewContainerβ).hide();
}
}
async function seeAllReviews_onClick(event) {
loadReviews();
}