We have a website (www.aromaspa.co.il) that consists of various product pages.
We would like to eliminate all the product pages and create a single product page that will be filtered each time you selected a category in the homepage.
We were able to do this, however, on the second time we select a different category from the homepage the single products page is loaded from the cache showing the previously selected category. Only manual refresh in the browser loads the currently selected category.
Is there a way to force refresh the page or the dataset?
Thank you.
I have the same problem, the repeater has the image assigned as a button but clicking on the image loads the product but the repeater continues to show the previous products and not those corresponding to the product on the page.
import wixData from 'wix-data'; import wixLocation from 'wix-location'; $w.onReady(function () { loadRelatedProducts(); }); async function loadRelatedProducts() { let product = await $w('#productPage1').getProduct(); let relatedProductsResult = await Promise.all([ relatedProductsByTable(product), relatedProductsByPrice(product) ]); if (relatedProductsResult[0].length > 0) showRelatedProducts(relatedProductsResult[0]); else showRelatedProducts(relatedProductsResult[1]); } async function relatedProductsByPrice(product) { let productId = product._id; let relatedByPrice = await wixData.query('Stores/Products') .between('price', product.price * 0.8, product.price * 1.2) .ne('_id', productId) .find(); return relatedByPrice.items; } async function relatedProductsByTable(product) { let productId = product._id; let relatedByTable = await Promise.all([ wixData.query('relatedProducts') .eq('productA', productId) .include('productB') .find(), wixData.query('relatedProducts') .eq('productB', productId) .include('productA') .find(), wixData.query('relatedProducts') .eq('productA', productId) .include('productC') .find(), wixData.query('relatedProducts') .eq('productC', productId) .include('productA') .find(), wixData.query('relatedProducts') .eq('productA', productId) .include('productD') .find(), wixData.query('relatedProducts') .eq('productD', productId) .include('productA') .find(), wixData.query('relatedProducts') .eq('productA', productId) .include('productE') .find(), wixData.query('relatedProducts') .eq('productE', productId) .include('productA') .find(), ]); let relatedProducts = [ ...relatedByTable[0].items.map(_ => _.productB), ...relatedByTable[1].items.map(_ => _.productA), ...relatedByTable[2].items.map(_ => _.productC), ...relatedByTable[4].items.map(_ => _.productD), ...relatedByTable[6].items.map(_ => _.productE), ]; return relatedProducts; } function showRelatedProducts(relatedProducts) { if (relatedProducts.length > 0) { relatedProducts.splice(4, relatedProducts.length); $w('#relateditemsRepeaters').onItemReady(relateItemReady); $w('#relateditemsRepeaters').data = relatedProducts; $w('#relatedItems').expand(); } else { $w('#relatedItems').collapse(); } } function relateItemReady($w, product) { $w('#productImage').src = product.mainMedia; $w('#productName').text = product.name; $w('#productPrice').text = product.formattedPrice; $w('#productImage').onClick(() => { wixLocation.to(product.productPageUrl); $w("#relateItemReady").data = showRelatedProducts(); }) }
https://321make.wixsite.com/website-3/product-page/buff-multiuso-tubular-25
It's difficult to answer without seeing the code. :( Do you mind sharing your page URL & code