Решено!
Шаблон MoneyMaker2
Сама функция
function addQuickOrder() {
$.ajax({
url: 'index.php?route=common/footer/addquickorder',
type: 'post',
data: $('#orderModal input[type=\'text\'], #orderModal input[type=\'checkbox\']:checked, #orderModal input[type=\'tel\'], #orderModal input[type=\'email\'], #orderModal input[type=\'hidden\'], #product input[type=\'number\'], #product input[type=\'text\'], #product input[type=\'hidden\'], #product input[type=\'radio\']:checked, #product input[type=\'checkbox\']:checked, #product select, #product textarea, #orderModal [name=\'g-recaptcha-response\']'),
dataType: 'json',
success: function(json) {
$('.alert, .text-danger').remove();
$('.form-group').removeClass('has-error');
if (json['error']) {
if (json['error']['option']) {
$('.options .collapse').show();
if ($('.options > div').hasClass("collapse")) {
$('.options > div:first-child').hide();
}
for (i in json['error']['option']) {
var element = $('#input-option' + i.replace('_', '-'));
if (element.parent().hasClass('input-group')) {
element.parent().after('<div class="text-danger">' + json['error']['option'][i] + '</div>');
} else {
element.after('<div class="text-danger">' + json['error']['option'][i] + '</div>');
}
}
}
if (json['error']['recurring']) {
$('select[name=\'recurring_id\']').after('<div class="text-danger">' + json['error']['recurring'] + '</div>');
}
if (json['error']['validation']) {
$("#orderModal .panel").removeClass('panel-info');
$("#orderModal .panel").addClass('panel-danger');
$("#orderModal .panel small").html(json['error']['validation']);
$('#orderModal .btn-primary').removeAttr('disabled');
}
$('.text-danger').parent().addClass('has-error');
}
if (json['success']) {
$("#orderModal .panel").removeClass('panel-danger');
$("#orderModal .panel").removeClass('panel-info');
$("#orderModal .panel").addClass('panel-success');
$("#orderModal .panel small").html(json['success']);
$('#orderModal .btn-primary').addClass('btn-success');
$('#orderModal .btn-primary').html('<i class="fa fa-check"></i> <?php echo $button_quickorder_success_message; ?>');
<!-- Редирект после отправки формы -->
if (json['success']) {
window.location.href = 'index.php?route=checkout/success';
}
<!-- Редирект после отправки формы -->
<?php if ($moneymaker2_modules_quickorder_goal_google) { ?>
ga('send', 'event', 'button', 'click', 'quickorder');
<?php } ?>
<?php if ($moneymaker2_modules_quickorder_goal_google_gtag) { ?>
gtag('event', 'click', {'event_category': 'button', 'event_label': 'quickorder'});
<?php } ?>
<?php if ($moneymaker2_modules_quickorder_goal_yandex&&$moneymaker2_modules_quickorder_goal_yandex_counter) { ?>
ym(<?php echo $moneymaker2_modules_quickorder_goal_yandex_counter; ?>, 'reachGoal', 'quickorder');
<?php } ?>
var moneymaker2_total_count = json['moneymaker2_total_count'];
var moneymaker2_total_sum = json['moneymaker2_total_sum'];
$('#cart > .dropdown-toggle #cart-total').html(moneymaker2_total_sum);
$('#cart > .dropdown-toggle .fa-stack .fa-stack-1x, .navbar-cart-toggle .fa-stack .fa-stack-1x').html(moneymaker2_total_count);
$('#cart > ul').load('index.php?route=common/cart/info ul li');
}
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
};
Добавляем
<!-- Редирект после отправки формы -->
if (json['success']) {
window.location.href = 'index.php?route=checkout/success';
}
<!-- Редирект после отправки формы -->