$('.boxer').boxer({
customClass: 'quickconditions'
});
$('#button-cart').bind('click', function () {
$.ajax({
url: 'index.php?route=checkout/cart/add',
type: 'post',
data: $('.product-info input[type=\'text\'], .product-info input[type=\'hidden\'], .product-info input[type=\'radio\']:checked, .product-info input[type=\'checkbox\']:checked, .product-info select, .product-info textarea'),
dataType: 'json',
success: function (json) {
$('.success, .warning, .attention, information, .error').remove();
if (json['affiliate_redirect']) {
location = json['affiliate_redirect'];
}
if (json['error']) {
if (json['error']['option']) {
for (i in json['error']['option']) {
$('#option-' + i).after('
' + json['error']['option'][i] + '');
}
}
}
if (json['success']) {
if (DIRECT_CHECKOUT) {
location = 'index.php?route=checkout/cart';
} else if (typeof (custom_notifier) == "function") {
custom_notifier(json['success']);
} else {
$('#notification').html('
' + json['success'] + '
');
$('.success').fadeIn('slow');
$('html, body').animate({scrollTop: 0}, 'slow');
}
$('#cart-total').html(json['total']);
}
}
});
});
$('#review .pagination a').live('click', function () {
$('#review').fadeOut('slow');
$('#review').load(this.href);
$('#review').fadeIn('slow');
return false;
});
$('#review').load('index.php?route=drop/product/review&product=2a0ec28fd46c4be268be4028f22e3672');
$('#button-review').bind('click', function () {
$.ajax({
url: 'index.php?route=drop/product/write&product=2a0ec28fd46c4be268be4028f22e3672',
type: 'post',
dataType: 'json',
data: 'name=' + encodeURIComponent($('input[name=\'name\']').val()) + '&merchant_code=qha' + '&text=' + encodeURIComponent($('textarea[name=\'text\']').val()) + '&rating=' + encodeURIComponent($('input[name=\'rating\']:checked').val() ? $('input[name=\'rating\']:checked').val() : '') + '&privacy_accept=' + encodeURIComponent($('input[name=\'privacy_accept\']:checked').val() ? $('input[name=\'privacy_accept\']:checked').val() : '0') + '&captcha=' + encodeURIComponent($('input[name=\'captcha\']').val()),
beforeSend: function () {
$('.success, .warning').remove();
$('#button-review').attr('disabled', true);
$('#review-title').after('
Si prega di attendere!
');
},
complete: function () {
$('#button-review').attr('disabled', false);
$('.attention').remove();
},
success: function (data) {
if (data['error']) {
$('#review-title').after('
' + data['error'] + '
');
}
if (data['success']) {
$('#review-title').after('
' + data['success'] + '
');
$('input[name=\'name\']').val('');
$('textarea[name=\'text\']').val('');
$('input[name=\'rating\']:checked').attr('checked', '');
$('input[name=\'captcha\']').val('');
}
}
});
});
$('#tabs a').tabs();