Black November!
Why wait for Black Friday? Your dream rugs are already discounted!
$(document).ready(function() {
var f = $('#rugFinderForm'), t = f.find('#typeSelect'), s = f.find('.facet-select'), i = f.find('input[name="facets"]'), b = f.find('button');
function d(e) {
$.ajax({
url: '/rest/finder/items',
type: 'GET',
dataType: 'json',
data: { facets: e.join(','), categoryId: t.val() },
beforeSend: function() { b.prop('disabled', true); },
success: function(r) {
u(e);
p(s.eq(0), r.facets[25].values, 25);
p(s.eq(1), r.facets[28].values, 28);
p(s.eq(2), r.facets[29].values, 29);
c(r.count);
},
error: function(x, m, a) { console.error('Error fetching data:', a); },
complete: function() { b.prop('disabled', false); }
});
}
function p(sel, v, id) {
var sv = sel.val();
sel.find('option[value!=""]').remove();
v.sort(function(a, b) { return a.id - b.id; });
$.each(v, function(_, o) {
if(id === 29) {
var ot = o.name.indexOf("/") > -1 ? o.name.split("/")[1].trim() : o.name;
var opt = $(' ', { value: o.id, text: ot });
} else {
var opt = $(' ', { value: o.id, text: o.name });
}
if (o.selected) opt.prop('selected', true);
sel.append(opt);
});
if (sv) sel.val(sv);
}
function c(n) {
b.html('' + (n > 0 ? n + ' Item found' : 'Make selection') + ' ');
}
function u(e) { i.val(e.join(',')); }
d([]);
s.on('change', function() {
var e = s.map(function() { return $(this).val(); }).get();
d(e);
});
t.on('change', function() {
var v = $(this).val(), u = '/rugs';
u = v === '76' ? '/modern-rugs' : (v === '87' ? '/oriental-rugs' : u);
f.attr('action', u);
s.val('');
d([]);
});
});
Reviews & Ratings
7.651+ Reviews
5
/ 5 in last 12 months
Our Partners for Sustainable Rug Production
People are at the heart of what we do