Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Javascript To Prevent Problem With Credit Card Orders


AllThingsTrendy

Recommended Posts

I have a regularly occuring problem becuase I also provide: 1) an option for customers to mail payment and 2) another for them to fax their credit card payment. Unfortunately, some cutomers type in their CC information and then click the wrong payment radio button. Thus, they think they have paid for thier order with a credit card when in fact they have not. When we contact them, they think we are cheating them because they are certain they entered their CC as payment.

 

To solve this problem, I want to add a JS to the payment page that will set the CC radio button automatically if there is anything typed in the CC field.

 

I hope someone can help since I am not good with JavaScript.... especially on a PHP site.

 

 

Thanks for any advice!

 

David

Anthony David

AllThingsTrendy.com

Link to comment
Share on other sites

  • 7 years later...

Amazingly, seven years later, I am back to this same challenge as we upgrade our site to OSC v2.3.  To solve the original problem posted in 2007, I had a friend graciously help me with writing some JavaScript that we utilized for several years.  Upon implementing that JS, all of the issues described within the original post, simply stopped.  It was beautiful!!!  
 
Unfortunately, the JS was not flexible enough to handle the addition and/or removal of payment modules.  Now, V2.3 payment options are a bit different and we have also changed which Merchant Services/Gateway.  Thus, we are back trying to find a resolution to this issue.  I did find a similar post to this but it seems to have challenges of its own.
 
Perhaps, I just haven't found the right post and someone has already described a solution that will...

  • Default the payment option to "Credit Card" rather than one of less desired and less frequently utilized options.
  • Set the CC radio button if any CC details are entered.
  • Prevent the customer from changing radio buttons until they delete all CC details?

Below is the script we used for several years.  But for some reason, it now only works once on the page.  It will identify if the user has input characters within the credit card number field while also selecting an alternative payment method.   However, it only does the check a single time rather than continuing to monitor their actions.
 
Perhaps someone with the right skills can improve upon it for all of us.

[size=2]<?

  echo "checkCreditCardNumber();";
  echo "function checkCreditCardNumber(){
      if(document.checkout_payment.authorizenet_aim_cc_number.value!=''  && (!document.checkout_payment.payment[1].checked  && !document.checkout_payment.payment[2].checked && !document.checkout_payment.payment[3].checked)){

        document.checkout_payment.payment[0].checked=true;
      }
      
      if( (document.checkout_payment.payment[1].checked || document.checkout_payment.payment[2].checked  ||
      document.checkout_payment.payment[3].checked) && document.checkout_payment.authorizenet_aim_cc_number.value!=''  ){

          alert('You have chosen to change payment type while also entering credit card number information.  If you prefer to use a payment method other than credit card, please first delete the credit card number you have entered.');
          document.checkout_payment.payment[0].checked=true;
          checkCreditCardNumber();
        
          return false;        

      }

      setTimeout('checkCreditCardNumber()',500);
    }
    ";
  echo "</script>";
  
?>​
[/size]

Anthony David

AllThingsTrendy.com

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...