1380 results
{
loading = true;
const query = new URLSearchParams(window.location.search).get('q') || '';
const searchParams = new URLSearchParams({ q: query }).toString();
const filterParams = new URLSearchParams(new FormData($refs.filter_form)).toString();
const no_results = document.querySelector('#NoResults');
fetch('/collections/on-sale?' + searchParams + '&' + filterParams)
.then(response => response.text())
.then(data => {
let html_div = document.createElement('div');
html_div.innerHTML = data;
let product_grid_container = html_div.querySelector('#ProductGridContainer');
let no_results_container = html_div.querySelector('#NoResults');
if (product_grid_container) {
document.querySelector('#ProductGridContainer').innerHTML = product_grid_container.innerHTML;
} else {
document.querySelector('#ProductGridContainer').innerHTML = no_results_container.innerHTML;
}
history.replaceState(null, null, '?' + searchParams + '&' + filterParams);
})
.catch(error => console.error('Error:', error))
.finally(() => loading = false);
})
"
@filter-reset.window="
$nextTick(() => {
loading = true;
fetch($event.detail)
.then(response => response.text())
.then(data => {
let html_div = document.createElement('div');
html_div.innerHTML = data;
let html_dom = html_div.querySelector('#ProductGridContainer').innerHTML;
document.querySelector('#ProductGridContainer').innerHTML = html_dom;
})
.catch(error => console.error('Error:', error))
.finally(() => loading = false);
})
"
@reset-price-filter.window="min = null, max = null"
>