';
html += '
';
html += '';
html += '
';
html += '';
html += '
' + json['success'] + '
';
html += '
';
html += '
';
html += '
';
$('body').append(html);
setTimeout(function() {$('.popup-note').hide();}, 8100);
$('#content').parent().before('
' + json['success'] + ' ×
');
dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object.
dataLayer.push({
event: "add_to_liked",
ecommerce: {
items: [{
item_name: "Система фильтров для масок и полумасок А1+формальдегид тип 6075 3М уп. 2 шт.",
item_id: "253417",
price: 760.4600,
item_brand: "",
item_category: "Лабораторная посуда и аксессуары",
item_category2: "Средства индивидуальной защиты",
item_list_name: "Средства индивидуальной защиты",
index: 1, // If associated with a list selection.
quantity: 1
}]
}
});
}
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
},
'remove': function() {
}
}
var compare = {
'add': function(product_id) {
$.ajax({
url: 'index.php?route=product/compare/add',
type: 'post',
data: 'product_id=' + product_id,
dataType: 'json',
success: function(json) {
$('.alert').remove();
if (json['success']) {
$('.alert, .popup-note, .basel-spinner.ajax-call, .text-danger').remove();
html = '';
$('body').append(html);
setTimeout(function() {$('.popup-note').hide();}, 8100);
$('#content').parent().before('
' + json['success'] + ' ×
');
}
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
},
'remove': function() {
}
}
$('#button-cart').on('click', function() {
//console.log($('#product input[type=\'hidden\']').val());
$.ajax({
url: 'index.php?route=checkout/cart/add',
type: 'post',
data: $('#product input[type=\'text\'], #product input[type=\'hidden\'], #product input[type=\'radio\']:checked, #product input[type=\'checkbox\']:checked, #product select, #product textarea'),
dataType: 'json',
beforeSend: function() {
//$('#button-cart').button('loading');
},
complete: function() {
//$('#button-cart').button('reset');
},
success: function(json) {
$('.alert, .text-danger').remove();
$('.form-group').removeClass('has-error');
if (json['error']) {
$('.alert, .popup-note, .basel-spinner.ajax-call, .text-danger').remove();
html = '';
$('body').append(html);
setTimeout(function() {$('.popup-note').hide();}, 8100);
}
if (json['success']) {
//$('#content').parent().before('
' + json['success'] + '×
');
$('.alert, .popup-note, .basel-spinner.ajax-call, .text-danger').remove();
html = '';
$('body').append(html);
setTimeout(function() {$('.popup-note').hide();}, 8100);
$('#total-count').html( json['total']);
//$('html, body').animate({ scrollTop: 0 }, 'slow');
fbq('track', 'AddToCart',
{
value: 760.4600,
currency: 'UAH',
content_ids: ['253417']
}
);
dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object.
dataLayer.push({
event: "add_to_cart",
ecommerce: {
items: [{
item_name: "Система фильтров для масок и полумасок А1+формальдегид тип 6075 3М уп. 2 шт.",
item_id: "253417",
price: 760.4600,
item_brand: "",
item_category: "Лабораторная посуда и аксессуары",
item_category2: "Средства индивидуальной защиты",
item_list_name: "Средства индивидуальной защиты",
index: 1, // If associated with a list selection.
quantity: 1
}]
}
});
}
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
});
$('#review').load('index.php?route=product/product/review&product_id=253417');
$('#button-review').on('click', function() {
$.ajax({
url: 'index.php?route=product/product/write&product_id=253417',
type: 'post',
dataType: 'json',
data: $("#form-comment").serialize(),
beforeSend: function() {
//$('#button-review').html('loading');
},
complete: function() {
//$('#button-review').html('reset');
},
success: function(json) {
$('.alert-success, .alert-danger').remove();
if (json['error']) {
$('#error_review').html(' ' + json['error'] + '');
}
if (json['success']) {
$('#error_review').html('
' + json['success'] + ' ');
$('input[name=\'name\']').val('');
$('textarea[name=\'text\']').val('');
}
}
});
});