Hi guys,
I’m sure this question was asked before but I haven’t found answers on this forum when I searched, so here goes.
I have a store on wix. I know the product pages are dynamic, and I know how to add a related products repeater to my product pages. So far, so good. I’m facing problems, however, with connecting my related products repeater to the dataset correctly. On some pages, it works like a dream! On others, it’s a total nightmare. Either it’s showing completely UNrelated products or not showing any related products at all.
Can you guys help me with the code?
@Service - Could you share your code so we can take a look?
I’m currently unable to post anything but text on this forum, so unfortunately, no. I used the same code from the Velo tutorial on YouTube, though, if that helps at all. (Not allowed to post links either so I can’t really do much here.)
Take a look at the Related Products example . You can load the example into the Editor, test it, play with it, and use the code for your own project.
@Yisrael I did just that and the code still doesn’t work. Even more stressing is the fact that it then said that my related products database was deleted, which it wasn’t. :\
Please post the URL of your site so we can inspect.
https: //www .spyshop .co .il is our website. Noticed how on some products it offers the correct related items, on others it either doesn’t show related product or is showing completely unrelated products.
Thanks!
Also sorry for breaking the link like that, it wouldn’t let me post otherwise…
On what pages does the problem occur?
No problem I found a page: עמוד מוצר
Any page in the GPS department. There are plenty of other pages where this occurs, as well.
This code, on the עמוב מוצר page, is accessing a DB collection that does not exist:
let relatedByTable = await Promise.all([
wixData.query('related-products')
.eq('productA', productId)
.include('productB')
.find(),
wixData.query('related-products')
.eq('productB', productId)
.include('productA')
.find()
]);
As you can see in the screenshot, the name of the collection is relatedProducts, and not related-products:
Now the related products repeater completely disappeared from my product page! Help!
On the עמוד מוצר page I see a related products repeater:
You need to make sure that all your pages reference the same database collection name - relatedProducts .
They do reference that database collection name. The question is, how do I make sure the repeater shows the correct related products on all pages and not just on some pages? Is there any way to make that happen?
You have a lot of pages with a lot of code. What pages are not working? I’m not able to guess. What works and what doesn’t?
I can’t post links on the forum, I don’t have permission, and the list of pages that aren’t working right is endless. Give me a minute.
I need to see at least one page that isn’t working so I can understand the problem. Otherwise I can’t help.
www .spyshop . co. il /product-page/g2-%D7%A1%D7%95%D7%9C%D7%9C%D7%94-5000
www .spyshop . co. il/product-page/%D7%97%D7%91%D7%99%D7%9C%D7%AA-%D7%98%D7%A8%D7%90%D7%A7%D7%99%D7%9E%D7%95-9000
www .spyshop . co. il /product-page/g2-800
www .spyshop . co. il /product-page/powerbank-gps
www .spyshop . co. il /product-page/%D7%90%D7%91%D7%9F-%D7%A7%D7%98%D7%A0%D7%94-%D7%9E%D7%A9%D7%93%D7%A8-gsm
www .spyshop . co. il /product-page/%D7%90%D7%94%D7%99%D7%9C-%D7%9E%D7%A9%D7%93%D7%A8-gsm
www .spyshop . co. il /product-page/g1-12000
www .spyshop . co. il /product-page/%D7%90%D7%A9%D7%9B%D7%95%D7%9C-4
www .spyshop . co. il /product-page/%D7%9E%D7%95%D7%A0%D7%99%D7%98%D7%95%D7%A8-%D7%98%D7%9B%D7%A0%D7%90%D7%99%D7%9D-ahd
www . spyshop . co. il /product-page/%D7%AA%D7%90%D7%95%D7%A8%D7%AA-%D7%97%D7%99%D7%A8%D7%95%D7%9D-%D7%94%D7%AA%D7%A7%D7%A0%D7%94-%D7%A2%D7%9C-%D7%A7%D7%99%D7%A8
www .spyshop . co. il /product-page /%D7%9E%D7%A4%D7%A6%D7%9C-%D7%97%D7%A9%D7%9E%D7%9C-2-gsm
These are just some of the problematic pages…
One of your example pages (www.spyshop.co.il/product-page/g2-800) shows one related product:
Are you supposed to have additional related products? You might have a problem with your code, although it looks OK to me. You have many products that contain many references to relevant products, and the product relationships that you have defined might be incorrect.
You should refer to the Related Products example for guidance and an explanation on how the relationships are defined.
Understand that this forum is not a support forum, and we are really unable to debug or rewrite your code for you. If you need coding assistance, it is possible to find expert developers on the Wix Marketplace , an online marketplace with top Velo web developers from around the world.