');
$('.mobile-category-header').prepend('
Фильтр товаров
');
$('.box-heading').prepend('
');
var portraitWidth = $(window).width();
if (portraitWidth parseInt(max+1)) {
$(this).children('.checkbox:gt('+max+')').hide().end().append(
$('
Доступно еще: (+'+parseInt($(this).find(".checkbox").length - (max+1))+') ').click(function() {
$(this).siblings(':hidden').show().end().remove();
})
);
}
if ($(this).find(".radio").length > parseInt(max+1)) {
$(this).children('.radio:gt('+max+')').hide().end().append(
$('
Доступно еще: (+'+parseInt($(this).find(".radio").length - (max+1))+') ').click(function() {
$(this).siblings(':hidden').show().end().remove();
})
);
}
});
}
function sort_filter_blocks() {
var $wrapper = $('#oct-product-filter-data');
$wrapper.find('.inner-box').sort(function(a, b) {
return +a.dataset.sort - +b.dataset.sort;
}).appendTo($wrapper);
}
function filter_mask(element, status) {
if (status == true) {
$('
')
.attr({'class':'masked'})
.prependTo(element);
$('
').insertAfter($('.masked'));
} else {
$('.masked').remove();
$('.masked_loading').remove();
}
}
$(function() {
if (parseInt($('#oct-product-filter-data input[name=\'low_price\']').val()) == parseInt($('#oct-product-filter-data input[name=\'high_price\']').val())) {
$('#oct-price-slider').remove();
}
sort_filter_blocks();
hide_long_list();
$('select[id="input-limit"], select[id="input-sort"]').removeAttr('onchange');
$('select[id="input-sort"]').empty();
custom_sort_options = '';
custom_sort_options += '
';
custom_sort_options += '
';
custom_sort_options += '
';
custom_sort_options += '
';
custom_sort_options += '
';
custom_sort_options += '
';
$('select[id="input-sort"]').append(custom_sort_options);
$('select[id="input-limit"]').empty();
custom_limit_options = '';
custom_limit_options += '
';
custom_limit_options += '
';
custom_limit_options += '
';
custom_limit_options += '
';
$('select[id="input-limit"]').append(custom_limit_options);
});
$('#button-reset').on('click', function() {
oct_reset_filter();
});
$(document).on('change', '#oct-product-filter-data input[type=\'text\'], #oct-product-filter-data input[type=\'hidden\'], #oct-product-filter-data input[type=\'radio\'], #oct-product-filter-data input[type=\'checkbox\'], #oct-product-filter-data select', function() {
oct_start_filter();
});
$(document).on('change', 'select[id="input-sort"], select[id="input-limit"]', function() {
oct_start_filter();
});
function oct_reset_filter() {
$('#oct-product-filter-data input[name=\'low_price\']').val('600');
$('#oct-product-filter-data input[name=\'high_price\']').val('600');
$('#oct-product-filter-data input[type=\'radio\']').removeAttr('checked');
$('#oct-product-filter-data input[type=\'checkbox\']').removeAttr('checked');
$('#oct-product-filter-data select').val('');
oct_start_filter({render_products: true});
}
function reset_selected_value(value, id, type) {
if (type == 'checkbox') {
$("#oct-product-filter-data #"+id).click();
}
if (type == 'radio') {
$("#oct-product-filter-data #"+id).removeAttr('checked');
oct_start_filter();
}
if (type == 'select') {
$("#oct-product-filter-data #"+id).parent().val('').change();
}
}
function oct_scroll_to_top() {
$("html, body").animate({
scrollTop: $('#oct-filter-tag').offset().top -60
}, {
duration: 800,
easing: "swing"
});
}
function oct_get_value_from_url(url, type) {
var value = 0;
if (type == 'sort' || type == 'limit' || type == 'order' || type == 'page') {
var arr = url.split("&");
}
for(var i = 0; i ');
oct_start_filter({increase_limit: 50, page: 1});
}
function oct_start_filter({count_totals = true, render_products = true, increase_limit = 0, page = 1} = {}) {
filter_mask('#oct-product-filter-data', true);
filter_mask('#res-products', true);
var oct_pf = [];
var oct_field_data = $('#oct-product-filter-data input[type=\'text\'], #oct-product-filter-data input[type=\'hidden\'], #oct-product-filter-data input[type=\'radio\']:checked, #oct-product-filter-data input[type=\'checkbox\']:checked, #oct-product-filter-data select').serializeArray();
$.each(oct_field_data, function(i, field) {
if (field.value) {
oct_pf.push({
name: field.name,
value: field.value
});
}
});
if (increase_limit) {
$('input[name="temp_limit"]').val(parseInt($('input[name="temp_limit"]').val()) + parseInt(increase_limit));
var limit = parseInt(oct_get_value_from_url($('select[id="input-limit"]').val(), 'limit')) + parseInt($('input[name="temp_limit"]').val());
} else {
var limit = oct_get_value_from_url($('select[id="input-limit"]').val(), 'limit');
}
oct_pf.push({
name: 'global_id',
value: '581'
}, {
name: 'global_type',
value: 'category'
}, {
name: 'route',
value: 'product/category'
}, {
name: 'sort',
value: oct_get_value_from_url($('select[id="input-sort"]').val(), 'sort')
}, {
name: 'order',
value: oct_get_value_from_url($('select[id="input-sort"]').val(), 'order')
}, {
name: 'limit',
value: limit
}, {
name: 'page',
value: page
}, {
name: 'url',
value: 'https://ivorytkani.ru/ribana-1-581/?oct_filter=1&price=600,600'
});
$.ajax({
type: 'post',
url: 'index.php?route=extension/module/oct_product_filter/filterProducts',
dataType: 'json',
data: oct_pf,
success: function(json) {
if (render_products) {
if (json['products']) {
product = '
';
if (json['error']) {
product += '
';
}
$.each(json['products'], function(i,value) {
product += '
';
product += '
';
product += '
';
if (json['oct_popup_view_status'] == '1' && value['quantity'] > 0) {
product += '
';
}
if (value['economy']) {
product += '
';
product += '
-'+value['economy']+'%
';
product += '
';
}
if (value['oct_product_stickers']) {
product += '
';
$.each(value['oct_product_stickers'], function(i,product_sticker) {
product += '
'+product_sticker['text']+'
';
});
product += '
';
}
product += '';
product += '
';
product += '
';
product += '
';
product += '
'+json['language']['text_sku']+' '+value['sku']+'
';
product += '
'+value['name']+'
';
product += '
';
if (value['rating'] > 0) {
$.each(["1","2","3","4","5",], function(index,element) {
if (value['rating'] ';
} else {
product += ' ';
}
});
} else {
$.each(["1","2","3","4","5",], function(index,element) {
product += ' ';
});
}
product += '
';
product += '
';
product += '
';
product += '
';
if (value['price']) {
product += '
';
if (!value['special']) {
product += ''+value['price']+'';
} else {
product += ''+value['special']+' '+value['price']+'';
}
product += '
';
}
product += '
';
if (value['quantity'] > 0) {
product += '
'+json['language']['button_cart']+'';
} else {
if (value['product_preorder_status'] == 1) {
product += '
'+value['product_preorder_text']+'';
} else {
product += '
'+value['product_preorder_text']+'';
}
}
product += '
';
product += '
';
product += '
';
product += '
';
product += '
';
product += '
'+json['language']['text_stock']+' '+value['stock']+'
';
product += '
';
product += '
'+value['description']+'
';
if (value['oct_options']) {
product += '
';
$.each(value['oct_options'], function(io,option) {
if (option['type'] == 'radio') {
product += '
';
} else {
product += '
';
}
});
product += '
';
}
product += '
';
product += '
';
product += '
';
product += '
';
product += '
';
});
product += '
';
if (json['show_more_limit_show']) {
product += '
';
product += '
';
product += '
';
}
product += '';
$('#res-products').html(product);
$('#res-products').fadeIn();
}
}
$.ajax({
type: 'post',
url: 'index.php?route=extension/module/oct_product_filter/filterProducts&update_seo_url=1',
dataType: 'json',
data: oct_pf,
success: function(json) {
window.history.pushState({}, $('h1').html(), json['url'].replace(/&/g, '&'));
}
});
if (count_totals) {
$.ajax({
url: 'index.php?route=extension/module/oct_product_filter',
type: 'POST',
data: oct_pf,
dataType: 'html',
success: function(data) {
$('#oct-product-filter-data').html($(data).find('#oct-product-filter-data').children());
hide_long_list();
sort_filter_blocks();
var oct_price_slider = document.getElementById('oct-price-slider');
noUiSlider.create(oct_price_slider, {
start: [parseInt($('#oct-product-filter-data input[name=\'low_price\']').val()), parseInt($('#oct-product-filter-data input[name=\'high_price\']').val())],
behaviour: 'hover',
connect: true,
margin: 1,
range: {
'min': [600],
'max': [600]
},
format: wNumb({
decimals: 0
}),
});
oct_price_slider.noUiSlider.on('update', function(values, handle) {
$('#oct-product-filter-data input[name=\'low_price\']').val(values[0]);
$('#oct-product-filter-data input[name=\'high_price\']').val(values[1]);
});
if (parseInt($('#oct-product-filter-data input[name=\'low_price\']').val()) == parseInt($('#oct-product-filter-data input[name=\'high_price\']').val())) {
$('#oct-price-slider').remove();
}
oct_price_slider.noUiSlider.on('end', function() {
oct_start_filter();
});
}
});
}
noUiSlider;
oct_price_slider.noUiSlider.set([parseInt($('#oct-product-filter-data input[name=\'low_price\']').val()), parseInt($('#oct-product-filter-data input[name=\'high_price\']').val())]);
$("#filter-mobile").removeClass("filter-show");
filter_mask('#oct-product-filter-data', false);
filter_mask('#res-products', false);
if (localStorage.getItem('display') == 'list') {
$('#list-view').trigger('click');
} else {
$('#grid-view').trigger('click');
}
if (!increase_limit) {
oct_scroll_to_top();
}
history.pushState({}, $('h1').html(), json['url'].replace(/&/g, '&'));
}
});
}
//-->
Артикул: НЕ0000020
0
Наличие: Есть в наличии