Hi I was wondering if it is possible to add review and ratings to dynamic pages. It is possible fo product pages but they have different element codes.
This picture is the dynamic page. The Red stars are all connected to my main dataset (conservation projects) and display different content depending on the page (repeaters). I then want a separate database for review that people can write for each individual item. These are the blue stars. I basically want people to be able to write a review on the dynamic page for each separate project that appears only on the dynamic page that they wrote the review.
This idea is similar to this tutorial Velo Tutorial: Adding Ratings and Reviews to a Wix Stores Site | Help Center | Wix.com but that tutorial is in reference to product pages and i’m not sure it will work on my site as the first lines of data are functions for product pages. (see example code below).
I am happy to try adding this tutorial code but i think it will be a waste of a lot of time. Any ideas how I can achieve the adding reviews on dynamic pages? Can I replace the product functions with another function that relates to my conservation project dataset. thanks
import wixData from 'wix-data';
import wixWindow from 'wix-window';
let product;
$w.onReady(async function () {
product = await $w('#productPage1').getProduct();
initReviews();
});
@ duncan.maguire Me too. I read that it can be done we just have to replace the “product” items with items that pertain to a dynamic page. for example $w(‘#dproductPage1’).getproduct would change to
$w(‘#dynamicDataset’).getCurrentItem(); I added my dynamicDataset… not sure if that is correct, but that is all I could find out. I am kind of confused on replacing the productId? What do I replace it with on a dynamic page?
I wish we could get some help on this particular code. I like the functionality.
Hi Eb.
Yes I managed to do it myself. You can replace the ‘products’ in the code with ‘items’ and it sort of works with a few more tweaks here and there…
where did you read that you could use get current item? I couldn’t find it anywhere!
If you follow the tutorial i have in my first post, basically instead of the product id i want it to relate to my title id. so I replace all the places that relates to product with title as thats the key for my field i wanted to link.
@duncanmaguire here is the link I was referring. The reference to the dynamic page. Thank you for the information regarding " product" I will try it out.
@duncanmaguire I tried replacing the “product” with my reference field but it did not work. Did you run into an error on the lightbox page that states ItemID must be a string? I do not think my .getcontext is collecting any data. If you had this issue how did you fix it? Part’s of my code is working but not all of it.
@emsimmons77 so instead of product i wanted to get right item from database.
so at the top its let title. as i am referencing the title field from my database)
then, title = await $w(‘#your dataset here’). getcurrentitem
@emsimmons77 not sure if that answers your problem. then whereever it says product in your code from then on replace it with ‘title’ or the field ID you want
@duncanmaguire hello thanks for replying. I did those step exactly. But my rating and " recommended " does not pull over.
@emsimmons77 Did you get any further with this?
I’m having the exact same problem,with a dynamic profiles page making customers leave reviews/ratings for, i’ve spent hours trying to figure out how to make it work, and it just isn’t having it, i followed Duncan what he said about replacing every where it says “product” in the codes with title (the first field name in my customer reviews database) and it just doesn’t work. do i need to still link all the elements in the repeater to the reviews dataset? is there any clever programmers out there who could kindly help? thanks