');
}
chmAddCartPpTimeout_id = setTimeout(function () {
$('.option-danger, .alert, .text-danger').remove();
}, 7000);
}
if (json['error']['gift']) {
$('#top').before('
' + json['error']['gift'] + '
×
');
}
if (json['error']['recurring']) {
$('select[name=\'recurring_id\']').after('
' + json['error']['recurring'] + '
');
}
// Highlight any found errors
$('.text-danger').parent().addClass('has-error');
}
if (json['success']) {
if(json['popup_design']=='1'){
fastorder_open_cart();
} else if(json['popup_design']=='0') {
html = '
';
html += '
';
html += '
';
if(json['show_onepagecheckout']=='1'){
html += '
' + json['success'] + '
'+ chSetting.button_shopping +' '+ chSetting.button_checkout +'
';
} else {
html += '
' + json['success'] + '
'+ chSetting.button_shopping +' '+ chSetting.button_checkout +'
';
}
html += '
';
html += '
';
html += '
';
$('body').append(html);
$('#modal-addcart').modal('show');
} else if(json['popup_design'] == '2') {
$('#top').before('
' + json['success'] + '
×
');
}
chmAddCartPpTimeout_id = setTimeout(function () {
$('.option-danger, .alert, .text-danger,.add_product_alert').remove();
}, 7000);
setTimeout(function () {
$('.cart-total').html(json['total']);
}, 100);
$('.shopping-cart .cart-content').load('index.php?route=common/cart/info .cart-content > *');
setTimeout(function () {
changeAddToCartBtn();
if(json['popup_design'] == '3'){
$('.shopping-cart > button').trigger('click');
}
}, 300);
}
$('#modal-addcart').on('hide.bs.modal', function (e) {
$('#modal-addcart').remove();
});
}
});
});
$('#review').delegate('.pagination a', 'click', function(e) {
e.preventDefault();
$('#review').fadeOut('slow');
$('#review').load(this.href);
$('#review').fadeIn('slow');
$('html, body').animate({ scrollTop: $('.ch-product-reviews').offset().top - 50}, 250);
});
let chmReviewTimeout_id = 0;
$('#button-review').on('click', function() {
$.ajax({
url: 'index.php?route=product/product/write&product_id=24748',
type: 'post',
dataType: 'json',
data: $("#form-review").serialize(),
beforeSend: function() {
$('#button-review').button('loading');
clearTimeout(chmReviewTimeout_id);
},
complete: function() {
$('#button-review').button('reset');
},
success: function(json) {
$('.alert-success, .alert.ch-alert-danger').remove();
if (json['error']) {
$('body').append('
');
}
chmReviewTimeout_id = setTimeout(function () {
$('.ch-alert-danger').remove();
}, 7000);
if (json['success']) {
$('#form-review input[name=\'name\']').val('');
$('#form-review textarea[name=\'plus\']').val('');
$('#form-review textarea[name=\'minus\']').val('');
$('#form-review textarea[name=\'text\']').val('');
$('#form-review input[name=\'rating\']:checked').prop('checked', false);
$('#form-review .label-star-prod').removeClass('checked');
$('#ch-modal-review').modal('hide');
html = '
';
html += '
';
html += '
';
html += '
' + json['success'] + '
×
';
html += '
';
html += '
';
html += '
';
$('body').append(html);
setTimeout(function () {
$('#modal-review-success').modal('show');
}, 500);
}
}
});
});
var url = document.location.toString();
if (url.match('#tab-review')) {
$('a[href=\'#tab-review\']').trigger('click');
}
function tabsActiveLine(){
setTimeout(function () {
$('.tabs__active_line').css({
'width':$('.tabs__header__scroll .my-tabs li.active').outerWidth(),
'left':$('.tabs__header__scroll .my-tabs li.active').offset().left - $('.tabs__header__scroll > .my-tabs').offset().left
});
}, 200);
}
$(document).ready(function() {
tabsActiveLine();
});
$(window).resize(function() {
tabsActiveLine();
if($('.tabs__header.tabs_top').length){
if (viewport().width .my-tabs').offset().left
});
let width_block = $('.tabs__header__scroll').width();
let li_width = $(this).outerWidth();
let li_left = $(this).parent().offset().left - $('.tabs__header__scroll > .my-tabs').offset().left;
let goLeft = li_left - (width_block / 2) + (li_width / 2);
if(goLeft > 0){
$('.tabs__header__scroll').animate({scrollLeft:goLeft})
} else {
$('.tabs__header__scroll').animate({scrollLeft:0})
}
});
function goTab(selector){
setTimeout(function () {
var top_tab = 10;
if ($(window).width() > 992) {
if($('.fix-header').length == 1) {
top_tab += $('.fix-header').outerHeight();
if($('.tabs__header.tabs_top').length){
top_tab += $('#content .tabs__header').outerHeight();
}
}
} else {
top_tab += 100;
}
$('html, body').animate({ scrollTop: $(selector).offset().top - top_tab + 30}, 250);
}, 100);
}
Интернет магазин Канцтовары.com © 2026