Hey all,
I was wondering how I would make the fields for the Authorize.net module required.
Currently, the fields are as follows:
// Entry
$_['entry_cc_owner'] = 'Card Owner:';
$_['entry_cc_number'] = 'Card Number:';
$_['entry_cc_expire_date'] = 'Card Expiry Date:';
$_['entry_cc_cvv2'] = 'Card Security Code (CVV2):';
I found a similar topic asking about this for PP Pro and it seems the OP received an answer, unfortunately there isn't an actual solution in the thread. Link is: http://forum.opencart.com/viewtopic.php ... 06#p201806
Any help would be GREATLY appreciated. Thanks in advance!
While this doesn't validate the fields, it will check to see if any of the fields are empty before submitting (English language only).
If empty, it will display a generic alert message letting the user know which fields are empty.
Find in '\catalog\view\theme\default\template\payment\authorizenet_aim.tpl'
Replace with:
This fix can definitely be elaborated on especially for localization purposes but this should do what you need.
If empty, it will display a generic alert message letting the user know which fields are empty.
Find in '\catalog\view\theme\default\template\payment\authorizenet_aim.tpl'
Code: Select all
<script type="text/javascript"><!--
$('#button-confirm').bind('click', function() {
$.ajax({
type: 'POST',
url: 'index.php?route=payment/authorizenet_aim/send',
data: $('#payment :input'),
dataType: 'json',
beforeSend: function() {
$('#button-confirm').attr('disabled', true);
$('#payment').before('<div class="attention"><img src="catalog/view/theme/default/image/loading.gif" alt="" /> <?php echo $text_wait; ?></div>');
},
success: function(json) {
if (json['error']) {
alert(json['error']);
$('#button-confirm').attr('disabled', false);
}
$('.attention').remove();
if (json['success']) {
location = json['success'];
}
}
});
});
//--></script>
Replace with:
Code: Select all
<script type="text/javascript">
<!--
$('#button-confirm').bind('click', function() {
var cc_owner_val = $('.cc_owner').val();
var cc_num_val = $('.cc_num').val();
var cc_cvv_val = $('.cc_cvv').val();
if(cc_owner_val != '' && cc_num_val != '' && cc_cvv_val != '') {
$('#button-confirm').bind('click', function() {
$.ajax({
type: 'POST',
url: 'index.php?route=payment/authorizenet_aim/send',
data: $('#payment :input'),
dataType: 'json',
beforeSend: function() {
$('#button-confirm').attr('disabled', true);
$('#payment').before('<div class="attention"><img src="catalog/view/theme/default/image/loading.gif" alt="" /> <?php echo $text_wait; ?></div>');
},
success: function(json) {
if (json['error']) {
alert(json['error']);
$('#button-confirm').attr('disabled', false);
}
$('.attention').remove();
if (json['success']) {
location = json['success'];
}
}
});
});
}
else {
var cc_alert_fields = '';
if(cc_owner_val == '') {
var alert_cc_owner = '\n Card Owner';
cc_alert_fields += alert_cc_owner;
}
if(cc_num_val == '') {
var alert_cc_num = '\n Card Number';
cc_alert_fields += alert_cc_num;
}
if(cc_cvv_val == '') {
var alert_cc_cvv = '\n Card Security Code (CVV2)';
cc_alert_fields += alert_cc_cvv;
}
var cc_alert = 'Please enter a value in the following fields: ' + cc_alert_fields;
alert(cc_alert);
}
});
//-->
</script>
This fix can definitely be elaborated on especially for localization purposes but this should do what you need.
Does anyone know how to do this with 1.5.6 because the code generously provided above does not work with it....
Don't understand why the simple required tag in the input field doesn't work. I really need to have the CVV2 field required.
Thanks so much in advance for any suggestions!
Don't understand why the simple required tag in the input field doesn't work. I really need to have the CVV2 field required.
Thanks so much in advance for any suggestions!
I needed this for a client so I went ahead and modified the code @EpiksolCreative provided to make it work on OpenCart v1.5.6.4 and converted it to a vQmod for simple updating.
Who is online
Users browsing this forum: No registered users and 2 guests