').find('.geke-filter-item').each(function(){
initFilterItem.call(this);
});
$(filter).each(function(){
initFilter.call(this);
});
// вызываем каждый фильтр
function initFilter() {
var self = this;
filterBlock(self);
}
// вызываем каждый из экземпляров фильтров
function initFilterItem() {
var self = this, // тут запоминаем jQuery-DOM-объект
data = $(this).attr('data'); // и его параметры
data = $.parseJSON(data);
view(self, data);
handler(self, data);
}
}
// блок фильтра
function filterBlock(block) {
console.log(document.URL);
// сбрасываем все настройки
$(block).find('.geke-filter-reset').click(function(event){
event.preventDefault();
//window.location.href = window.location.pathname;
$(block).find('.cancel-button').click();
});
// делаем get-запрос с параметрами
$(block).find('.geke-filter-item_submit_button').click(function(event){
event.preventDefault();
var url = '&';
$(block).find('.geke-values').each(function(){
if ($(this).val() !== '') {
values = $(this).val().split(',');
url = url + 'filter_' + $(this).attr('name') + '=';
for (var i=0; i Notice: Undefined variable: filter_all_category in /var/www/saviobags.ru/catalog/view/theme/default_new/template/module/filter.tpl on line 285".split('|');
var restoreColorData = "Notice: Undefined variable: filter_all_tczvet in /var/www/saviobags.ru/catalog/view/theme/default_new/template/module/filter.tpl on line 287".split('|');
var restoreSizeData = "Notice: Undefined variable: filter_all_razmer in /var/www/saviobags.ru/catalog/view/theme/default_new/template/module/filter.tpl on line 288".split('|');
var restoreBrandData = "Notice: Undefined variable: filter_all_brand in /var/www/saviobags.ru/catalog/view/theme/default_new/template/module/filter.tpl on line 289".split('|');
if (data.type !== 'slider') restoreList();
function restoreList() {
// словарь id элементов списка
var listGlossary = [];
$(element).find('li').each(function(){
listGlossary.push($(this).attr('data-id'));
});
// находим совпадение, отмечаем элемент, если оно есть
for (var i=0; i -1) $(element).find('li:nth-child(' + n + ')').addClass('active');
}
for (var i=0; i -1) $(element).find('li:nth-child(' + n + ')').addClass('active');
}
for (var i=0; i -1) $(element).find('li:nth-child(' + n + ')').addClass('active');
}
for (var i=0; i -1) $(element).find('li:nth-child(' + n + ')').addClass('active');
}
}
// присваиваем элементу фильтра класс, соответствующий типу
$(element).addClass('' + data.type + '');
// для элементов типа list делаем имитацию чекбоксов
if (data.type === 'list') {
$(element).find('li').each(function(){
$(this).html('
' + $(this).text() + '
')
})
}
// слайдер
if (data.type === 'slider') {
// случайный id для слайдера, чтобы не мешать с другими экземплярами слайдеров, требуется для корректной работы jQuery UI Slider
var slider_id = Math.round(Math.random()*(9999999)) + 1;
$(element).find('span:not(.title)').remove();
$(element).append('