Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

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


etzeppy

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

Link to comment
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.

Link to comment
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....

Link to comment
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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...