top of page

Forum Comments

Error in "Wishlist"(currentIndexChanged event)
In Coding with Velo
Ella
May 19, 2019
Thank you so much for your quick reply!! Amazing! I have played with the corvid/wix wishlist in the editor today, but since the wix wishlist use wix store, I still have problems. I kind of have to mix this code-examples, but reference field gives me headache! 1) The items collection(named "Andelsarbeid") and items page (named "Andelsarbeid") works fine 2) The dynamic page Item(ID)(named "Andelsarbeid(ID)") use the my-wishlist collection (named "mittarbeid2") is the problem I am able to populate the data, but not able to save to the "mittarbeid2" datacollection, because I am struggling with the reference field. In the field, I am supposed to add the product _id from the items collection - but how?? This is a code snippet from the item page This code is in testeng mode - I know it is wrong - but just can´t figure out how to add the referenced field _id into the "mittarbeid2"collection function dothewish() { let userId = user.id; wixData.query("mittarbeid2") .eq("product", product_name) .include('product') -->using include???? .eq("userId", userId) .find() .then((results) => { let items = results.items; let firstItem = items[0]; let firstRefProp = firstItem.product._id-->just testing.... let count = results.totalCount; if (count === 0) { let toSave = { "product": firstRefProp-->here, the _id of the referenced collection should be "userId": userId }; wixData.save("mittarbeid2", toSave); $w("#addtowishlist").label = "REMOVE FROM WISH LIST"; } else { wixData.remove("mittarbeid2", firstItem._id); $w("#addtowishlist").label = "ADD TO WISH LIST"; } }) .catch( (error) => { let errorMsg = error.message; let code = error.code; } ); }
0
0
Strange Error: The News_Feed collection does not exist.
In Coding with Velo
Ella
Apr 17, 2019
Any updates on this?
0
0

Ella

More actions

This website was designed with Velo by Wix

bottom of page