import { items } from "@wix/data"; import { memory } from "@wix/site-storage"; $w.onReady(async function () { const keywordsfromMemory = await memory.getItem("items"); const keywordsArray = JSON.parse(keywordsfromMemory); getProducts(keywordsArray); }); function initProductRepeater() { $w("#productsRepeater").onItemReady(($item, itemData) => { $item("#productTitle").text = itemData.productName; $item("#productImage").src = itemData.image; $item("#productImage").link = itemData.url; $item("#productImage").tooltip = ""; $item("#productPrice").text = itemData.price; $item("#productButton").link = itemData.url; $w("#giftsMainContainer").show(); }); } function getProducts(keywordsArray) { items .query("Productskeywords") .hasAll("keywords", keywordsArray) .include("product") .find() .then((results) => { if (results.items.length > 0) { let resItems = results.items; let products = resItems.map((item) => { return { _id: item.product._id, productName: item.product.name, url: item.product.productPageUrl, price: item.product.formattedPrice, image: item.product.mainMedia, }; }); const productsSliced = products.slice(0, 2); $w("#productsRepeater").data = productsSliced; initProductRepeater(); $w("#productsRepeater").show(); } else { $w("#giftsHeadingText").text = "Sorry, we could not find a product to recommend. Please try again."; } }); } import { memory } from "@wix/site-storage"; import { location } from "@wix/site-location"; const totalQuestions = 4; $w.onReady(function () { for (let i = 1; i <= totalQuestions; i++) { setupRepeaters(i); } }); function setupRepeaters(itemNo) { let keywordsArray = []; let nextStateNo = itemNo < totalQuestions ? itemNo + 1 : null; $w("#answersRepeater" + itemNo).forEachItem(($item, itemData, index) => { $item("#answerItemBox" + itemNo).onClick(async () => { keywordsArray.push($item("#answerText" + itemNo).text); if (nextStateNo) { $w("#answersMultistateBox").changeState("state" + nextStateNo); } else { memory.setItem("items", JSON.stringify(keywordsArray)); location.to("/products"); } }); }); } .button { width: 200px; cursor: default; background-color: #116dff; } .button__label { font-family: sans-serif; font-weight: 700; text-transform: lowercase; color: black; } .button__icon { width: 50px; height: 50px; border-radius: 50%; box-shadow: 5px 5px 10px; } function registerListener() { window.wixDevelopersAnalytics.register('head', (eventName, eventParams) => console.log('wix dev head', eventName, eventParams)); } window.wixDevelopersAnalytics ? registerListener() : window.addEventListener('wixDevelopersAnalyticsReady', registerListener); window.wixDevelopersAnalytics.register('app-ID', function report(eventName, data) { switch(eventName) { case 'pageview': callMyPageViewFunction(data); break; case 'addToCart': callMyAddToCartFunction(data); break; } }
top of page

Item List

Placeholder Image

This is a Title 01

This is placeholder text. To change this content, double-click on the element and click Change Content.

Placeholder Image

This is a Title 02

This is placeholder text. To change this content, double-click on the element and click Change Content.

Placeholder Image

This is a Title 03

This is placeholder text. To change this content, double-click on the element and click Change Content.

bottom of page