Jump to content
Sign in to follow this  
etzeppy

How to add an error check to the check/money order module

Recommended Posts

On occasion a customer will inadvertently select the check/money order method of payment when they intend to pay by credit card. The credit cart input fields are still available for input on the payment screen. The customer can input their credit card data and never notice that the wrong payment type was selected. I would like to either:

 

1) add an error check in the check/money order payment module and return an error if a credit card number has been input

 

or

 

2) disable credit card entry fields if check/money order is selected

 

I am looking for input on which of those two would easier to do and where I might look for ideas on how to implement.

 

Thanks

Share this post


Link to post
Share on other sites
On occasion a customer will inadvertently select the check/money order method of payment when they intend to pay by credit card.

you can create stupid proof system, as a customer can enter wrong address too :rolleyes::)

 

No connection between two modules, but you can put the message in red colour to ask customers to select right payment method.

Edited by web-project

Please read this line: Do you want to find all the answers to your questions? click here. As for contribution database it's located here!

8 people out of 10 don't bother to read installation manuals. I can recommend: if you can't read the installation manual, don't bother to install any contribution yourself.

Before installing contribution or editing/updating/deleting any files, do the full backup, it will save to you & everyone here on the forum time to fix your issues.

Any issues with oscommerce, I am here to help you.

Share this post


Link to post
Share on other sites

you can create stupid proof system, as a customer can enter wrong address too :rolleyes::)

 

point taken. They do seem to find new and interesting ways to defeat logic. This check payment issue has happened several times in past few months, which made me think it was a pretty easy mistake to make. Maybe a little red text will do it. I've added red text in other areas of the checkout process.

 

For kicks, I borrowed a little code from the CC module to test if the card number length was >0 but it's not really working. If someone enters card info, it picks that up with no problem. However, if no card info is entered at all and the field is never "touched", the result does not seem to be 0. I can't quite figure that out....

Share this post


Link to post
Share on other sites

I did get something working. I borrowed some of the error checking code from the standard CC module and tweaked it a bit. I'm not sure if I am going to keep it, but it does work.

 

In /includes/modules/moneyorder.php

 

FIND:

function javascript_validation() {
     return false;

 

REPLACE WITH:

     function javascript_validation() {
     $js = '  if (payment_value == "' . $this->code . '") {' . "\n" .
           '    var cc_number = document.checkout_payment.cc_number.value;' . "\n" .
           '    if (cc_number.length > ' . '0' . ') {' . "\n" .
           '      error_message = error_message + "' . MODULE_PAYMENT_MONEYORDER_TEXT_JS_CC_NUMBER . '";' . "\n" .
           '      error = 1;' . "\n" .
           '    }' . "\n" .
           '  }' . "\n";
     return $js;

 

 

MODULE_PAYMENT_MONEYORDER_TEXT_JS_CC_NUMBER is the text you want displayed in the error pop-up, which I added to moneyorder.php language file.

 

 define('MODULE_PAYMENT_MONEYORDER_TEXT_JS_CC_NUMBER', 'A Credit Card number should not be entered for this payment type. 
Please verify your payment method selection or remove the credit card number from the payment form.\n');

 

The code tests the credit card number entry field on the payment page and makes sure it is blank if the check/money order payment method has been selected.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×