我已在Magento上启用了Paypal payment pro,并且在一页结帐的步骤5中添加了卡片详细信息后,继续按钮不起作用。我也尝试在控制台中运行相关的javascript函数payment.save()但没有成功。
如果我选择了将用户重定向到paypal登录的普通paypal express选项,则继续按钮有效。
我一直在查看相关的javascript库/skin/frontend/em006/default/js/opcheckout.js和payment.save()函数,但看不到任何明显可能导致问题的内容。
有人有任何想法吗?
以下是付款功能:
// payment
var Payment = Class.create();
Payment.prototype = {
beforeInitFunc:$H({}),
afterInitFunc:$H({}),
beforeValidateFunc:$H({}),
afterValidateFunc:$H({}),
initialize: function(form, saveUrl){
this.form = form;
this.saveUrl = saveUrl;
this.onSave = this.nextStep.bindAsEventListener(this);
this.onComplete = this.resetLoadWaiting.bindAsEventListener(this);
},
addBeforeInitFunction : function(code, func) {
this.beforeInitFunc.set(code, func);
},
beforeInit : function() {
(this.beforeInitFunc).each(function(init){
(init.value)();;
});
},
init : function () {
this.beforeInit();
var elements = Form.getElements(this.form);
if ($(this.form)) {
$(this.form).observe('submit', function(event){this.save();Event.stop(event);}.bind(this));
}
var method = null;
for (var i=0; i<elements.length; i++) {
if (elements[i].name=='payment[method]') {
if (elements[i].checked) {
method = elements[i].value;
}
} else {
elements[i].disabled = true;
}
elements[i].setAttribute('autocomplete','off');
}
if (method) this.switchMethod(method);
this.afterInit();
},
addAfterInitFunction : function(code, func) {
this.afterInitFunc.set(code, func);
},
afterInit : function() {
(this.afterInitFunc).each(function(init){
(init.value)();
});
},
switchMethod: function(method){
if (this.currentMethod && $('payment_form_'+this.currentMethod)) {
var form = $('payment_form_'+this.currentMethod);
form.style.display = 'none';
var elements = form.select('input', 'select', 'textarea');
for (var i=0; i<elements.length; i++) elements[i].disabled = true;
}
if ($('payment_form_'+method)){
var form = $('payment_form_'+method);
form.style.display = '';
var elements = form.select('input', 'select', 'textarea');
for (var i=0; i<elements.length; i++) elements[i].disabled = false;
}
this.currentMethod = method;
},
addBeforeValidateFunction : function(code, func) {
this.beforeValidateFunc.set(code, func);
},
beforeValidate : function() {
var validateResult = true;
var hasValidation = false;
(this.beforeValidateFunc).each(function(validate){
hasValidation = true;
if ((validate.value)() == false) {
validateResult = false;
}
}.bind(this));
if (!hasValidation) {
validateResult = false;
}
return validateResult;
},
validate: function() {
var result = this.beforeValidate();
if (result) {
return true;
}
var methods = document.getElementsByName('payment[method]');
if (methods.length==0) {
alert(Translator.translate('Your order can not be completed at this time as there is no payment methods available for it.'));
return false;
}
for (var i=0; i<methods.length; i++) {
if (methods[i].checked) {
return true;
}
}
result = this.afterValidate();
if (result) {
return true;
}
alert(Translator.translate('Please specify payment method.'));
return false;
},
addAfterValidateFunction : function(code, func) {
this.afterValidateFunc.set(code, func);
},
afterValidate : function() {
var validateResult = true;
var hasValidation = false;
(this.afterValidateFunc).each(function(validate){
hasValidation = true;
if ((validate.value)() == false) {
validateResult = false;
}
}.bind(this));
if (!hasValidation) {
validateResult = false;
}
return validateResult;
},
save: function(){
if (checkout.loadWaiting!=false) return;
console.log(checkout.loadWaiting);
var validator = new Validation(this.form);
if (this.validate() && validator.validate()) {
checkout.setLoadWaiting('payment');
var request = new Ajax.Request(
this.saveUrl,
{
method:'post',
onComplete: this.onComplete,
onSuccess: this.onSave,
onFailure: checkout.ajaxFailure.bind(checkout),
parameters: Form.serialize(this.form)
}
);
console.log('run');
}
else {
console.log('failed');
}
},
resetLoadWaiting: function(){
checkout.setLoadWaiting(false);
},
nextStep: function(transport){
if (transport && transport.responseText){
try{
response = eval('(' + transport.responseText + ')');
}
catch (e) {
response = {};
}
}
/*
* if there is an error in payment, need to show error message
*/
if (response.error) {
if (response.fields) {
var fields = response.fields.split(',');
for (var i=0;i<fields.length;i++) {
var field = null;
if (field = $(fields[i])) {
Validation.ajaxError(field, response.error);
}
}
return;
}
alert(response.error);
return;
}
checkout.setStepResponse(response);
//checkout.setPayment();
},
initWhatIsCvvListeners: function(){
$$('.cvv-what-is-this').each(function(element){
Event.observe(element, 'click', toggleToolTip);
});
}
}
答案 0 :(得分:1)
Magento中存在IE9的已知错误。您没有提到您正在使用的浏览器,但我们必须确保在所有Magento网站上都包含此标记。
<meta http-equiv="X-UA-Compatible" content="IE=8" />