Rug Finder:
'); }); } function fmtSize(n) { return n.replace(/(\d+(\s?x\s?\d+)?\s?cm)/g, "$1"); } function resetDropdown(dd, dt) { dd.attr('data-value', ''); dd.closest('.dropdown').find('input[type="hidden"]').val(''); pMin.val(''); pMax.val(''); debouncedApiCall(); } function sel(dd, v, t) { if (t === 'Remove selection') { t = { priceDropdown: 'Select price', colorDropdown: 'Select colour', sizeDropdown: 'Select size' }[dd.attr('id')] || t; } if (dd.attr('data-value') !== String(v)) { dd.text(t).attr('data-value', v); dd.closest('.dropdown').find('input[type="hidden"]').val(v); debouncedApiCall(); } } function apiCall() { var fcts = [v.clr.val(), v.sz.val()].filter(x => x && x.trim()); fi.val(fcts.join(',')); fetchData(fcts); } f.on('submit', function(e) { var p = new URLSearchParams(); if (pMin.val()?.trim()) p.append('priceMin', pMin.val()); if (pMax.val()?.trim()) p.append('priceMax', pMax.val()); if (fi.val()?.trim()) p.append('facets', fi.val()); p.append('categoryId', v.t.val() || '73'); f.attr('action', '/rugs' + '?' + p.toString()); f.off('submit').submit(); }); $(document).on('click', '.price-dropdown .dropdown-item', function() { var min = $(this).data('min'), max = $(this).data('max'); if (min === 0 && max === 0) { resetDropdown(pD, 'Select price'); return; } if (pMin.length && pMax.length) { pMin.val(min); pMax.val(max); } else { console.error('Price range inputs missing.'); return; } var lbl = max ? min + ' € - ' + max + ' €' : min + '€ +'; pD.text(lbl); debouncedApiCall(); }); $(document).on('click', '.dropdown-item', function() { const dd = $(this).closest('.dropdown').find('.btn'); sel(dd, $(this).data('value'), $(this).text()); }); d.t.on('click', '.dropdown-item', function() { const val = $(this).data('value'); f.attr('action', val === '76' ? '/modern-rugs' : val === '87' ? '/oriental-rugs' : '/rugs'); v.t.val(val); debouncedApiCall(); }); if (!v.clr.val() && !v.sz.val()) fetchData([]); });
Top Categories
Show AllBest Seller
Show AllOur Newest Arrivals
All New ArrivalsShop by Rooms
Show AllOur Partners for Sustainable Rug Production
People are at the heart of what we do