Advanced Wish List Code Revealed

Hi Everyone : )

You can find this video on YouTube (or watch it in this forum). Find me on YouTube under Wix Expert or click this link for my channel: https://www.youtube.com/channel/UCy4ydlG0gU7cTUBDYTD2I_A?

Link to Tutorial Site: https://webixdesigns.wixsite.com/wishlistpart2
Link to the Code: https://www.totallycodable.com/Templates/Beginner/Database/Code-Snippet/Advanced-Wish-List-Code

(Please excuse the construction on that site … it’s almost done)

#totallycodable

4 Likes

add to the data base and remove from data base code is working but the code for wish list page is not working
wish list page code

import wixUsers from ‘wix-users’;
import wixData from ‘wix-data’;

$w.onReady( function () {
getfilters();

});

function getfilters() {
let user = wixUsers.currentUser;
let userId = user.id;
console.log(userId);
wixData.query(“Orderlist”)//this is my wish list database
.eq(“userId”, userId)
.find()
.then((results) => {
let items = results.items;
let firstItem = items[0];
var prod = ;
var i = 0;
console.log(results.length);
var vf = results.length;
while (i < vf) {
console.log(i);
prod[i] = items[i].productId;
console.log(items[i].productId);
i = i + 1;
console.log(prod[i]);
}
console.log(prod);
$w(“#orderlistfc”).setFilter(wixData.filter() //this is my wishlist page dataset
.hasSome(“item”, prod)
);
});
}

Hi : )

I cannot see the connections on your page, but make sure that your dataset is connected to the items list and NOT the wishlist database.

thank you .
now it’s working properly
my dataset connection was wrong