gpt4 book ai didi

php - Opencart中的结帐验证在哪里

转载 作者:可可西里 更新时间:2023-11-01 01:03:03 24 4
gpt4 key购买 nike

我遇到的问题是,在“交付方法”部分,Ajax 出于某种原因无法验证。

在下面的代码中(来自 checkout/checkout.tpl),BeforeSend 和 complete 函数正在触发,但 success 中的函数没有触发。

谁能告诉我“index.php?route=checkout/shipping_method/validate”在哪里设置?

谢谢

$('#button-shipping-method').live('click', function() {
$.ajax({
url: 'index.php?route=checkout/shipping_method/validate',
type: 'post',
data: $('#shipping-method input[type=\'radio\']:checked, #shipping-method textarea'),
dataType: 'json',
beforeSend: function() {
$('#button-shipping-method').attr('disabled', true);
$('#button-shipping-method').after('<span class="wait">&nbsp;<img src="catalog/view/theme/default/image/loading.gif" alt="" /></span>');
},
complete: function() {
$('#button-shipping-method').attr('disabled', false);
$('.wait').remove();
},
success: function(json) {
$('.warning, .error').remove();

if (json['redirect']) {
location = json['redirect'];
} else if (json['error']) {
if (json['error']['warning']) {
$('#shipping-method .checkout-content').prepend('<div class="warning" style="display: none;">' + json['error']['warning'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');

$('.warning').fadeIn('slow');
}
} else {
$.ajax({
url: 'index.php?route=checkout/payment_method',
dataType: 'html',
success: function(html) {
$('#payment-method .checkout-content').html(html);

$('#shipping-method .checkout-content').slideUp('slow');

$('#payment-method .checkout-content').slideDown('slow');

$('#shipping-method .checkout-heading a').remove();
$('#payment-method .checkout-heading a').remove();

$('#shipping-method .checkout-heading').append('<a>Modify &raquo;</a>');

},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
}
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
});

最佳答案

因为 url 显示了 Controller 结构,您可以在名称为 ControllerCheckoutShippingMethod 的类中找到 validate 函数,它位于

catalog\controller\checkout\shipping_method.php

关于php - Opencart中的结帐验证在哪里,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18283137/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com