Hi, I am trying to use the wix stores template (rather than create my own repeater, as the filters and sort are built in already which saves time, as well as the cart page, thank you page all being linked etc)
I have written some code for a search bar and tested it on a test repeater I created myself, and it works fine. When i then try and add the code to the ‘Shop’ page of my wix stores, i get no errors but the search just doesnt work. I have put the code below.
Any ideas? Thanks
import wixData from ‘wix-data’;
$w.onReady( function () {
});
let lastFilterName;
let debounceTimer;
function filter(name) {
if (lastFilterName !== name) {
let newFilter = wixData.filter();
if (name)
newFilter = newFilter.contains(“name”, name);
$w(“#dataset1”).setFilter(newFilter);
lastFilterName = name;
}
}
export function search_keyPress(event) {
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
filter($w(“#search”).value, lastFilterName)
})
}