https://support.wix.com/en/article/corvid-tutorial-adding-ratings-and-reviews-to-a-wix-stores-site
Hello,
I used this tutorial for adding review(not ratings) on my page, but I didn’t do something right. When I click “submit” button on my product page, all data is stored correctly in database, but review doesn’t show. When I refresh page, review show but after two seconds delete itself .
When I hide “initReviews” function, reviews shows but for all products, so I guess problem is something with filter. ‘idProduct’ is field that reference to Store/Products collection auto generated when I open a store on Wix.
Please help. My code and collection:
For starters you are missing code from step 5 which is lines 12-15 in yours.
async function initReviews() {
await $w('#Reviews').setFilter(wixData.filter().eq('productId', product._id));
showReviews();
loadStatistics();
}
You are missing the ‘loadStatistics();’ line here which is used later on in the tutorial that you have omitted from your page code.
Understanding the Code
Line 2: Chain an eq function to setFilter to filter out all items in the Reviews dataset where the product ID doesn’t match the ID of the currently displayed product.
Line 3: Run the showReviews function to display all filtered reviews.
Line 4: Run the loadStatistics function to load and display statistics for the current product.
Step 7: Create the reviewsRepeater_itemReady Function on the Product Page
We selected the reviewsRepeater element and, in the Properties panel, added an onItemReady event handler.
In Step 5 the initReviews function filters the Reviews dataset to contain only reviews of the currently displayed product. Each filtered item (row) in the collection is passed to the reviewsRepeater_itemReady event handler as the itemData parameter.
Therefore I would suggest that you double check all your code for the product page itself and the review lightbox and use the tutorial as it is.
I would also suggest calling your dataset fields in the Reviews dataset, the same as in the tutorial itself.
As with Product Id (productId) instead of yours as IDProduct (idProduct) as it saves you having to go through the code and making sure that you have replaced it at all the correct places etc.
@givemeawhisky I also have an issue with the Tutorial. The “Load More” button is always visible, even when you have just one review in your Repeater. How do you code the visibility of the button based on the numbers of reviews you have define to show in your repeater?
I still cannot solve this issue (you can check under any product page in www.chicdog.cl)..)
I also have a doubt regarding the star rating. It is possible to see the product rating summary beneath the product title, as is shown by Kudobuzz App? It is also possible to add the rating summary in the product Gallery item as it is done by the majority of e-commerce platforms?
I am now trying to define two flows for reviewers: Certified Client Purchase Review And Visitor Review. For the former the idea is to setup a Trigger Email 2 days after the Order is Fullfilled. Can I do this using dynamic values in a Trigger E-mail? I don’t see a value as an order.
For the Visitor Reviewers, how I can cross check if the visitor didn’t actually purchase that specific product?