Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Can I set oscomm to accept only visa/mastercard?


Guest

Recommended Posts

Hi,

Can someone please help me.

I Only accept Visa And Mastercard which I process offline. Is there a way to setup OScommerce to only let the customer pay by Visa and Masterecard.

On our oscommerce site when you click on payment it just says credit card.

If someone runs a Discover or American Express through we have to email them and tell them that we dont accept those cards.

 

How can we set oscommerce to only take visa and mastercards through offline processing.

 

please help me Im STUCK!!!!!

 

Thanks in advance.

 

John

Link to comment
Share on other sites

Yes, you can do this. In includes/classes/cc_validation.php, you will see a long if..elseif test in the function validate. Replace it as follows:

 

      if (ereg('^4[0-9]{12}([0-9]{3})?$', $this->cc_number)) {
       $this->cc_type = 'Visa';
     } elseif (ereg('^5[1-5][0-9]{14}$', $this->cc_number)) {
       $this->cc_type = 'Master Card';
     } else {
       return -1;
     }

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...

Like so:

  function validate($number, $expiry_m, $expiry_y) {
     $this->cc_number = ereg_replace('[^0-9]', '', $number);

     if (ereg('^4[0-9]{12}([0-9]{3})?$', $this->cc_number)) {
       $this->cc_type = 'Visa';
     } elseif (ereg('^5[1-5][0-9]{14}$', $this->cc_number)) {
       $this->cc_type = 'Master Card';
     } elseif (ereg('^3[47][0-9]{13}$', $this->cc_number)) {
       //$this->cc_type = 'American Express';
     } elseif (ereg('^3(0[0-5]|[68][0-9])[0-9]{11}$', $this->cc_number)) {
       //$this->cc_type = 'Diners Club';
     } elseif (ereg('^6011[0-9]{12}$', $this->cc_number)) {
       //$this->cc_type = 'Discover';
     } elseif (ereg('^(3[0-9]{4}|2131|1800)[0-9]{11}$', $this->cc_number)) {
       //$this->cc_type = 'JCB';
     } elseif (ereg('^5610[0-9]{12}$', $this->cc_number)) { 
       //$this->cc_type = 'Australian BankCard';
     } else {
       return -1;
     }

Link to comment
Share on other sites

he means to turn your php code into a comment.

 

Regular code:

<?php blah blah here is some code?>

 

By placing this // in front of the code, it turns it into a comment instead of actual code to be processed. These comments are for the webmaster so he can know what he's doing. Oscommerce labels all their codes with these comments if you haven't noticed. They are highlighted in orange using dreamweaver MX.

 

Like so:

 

<?php //blah blah here is some code?>

Link to comment
Share on other sites

  • 6 months later...
  • 1 year later...
  • 6 months later...

Hi Guys

 

I am trying to do this at the moment but regardless of which cards i comment or add the only CC number my site will use is the default 41111111111 number.

 

Is there a way to disable this. I know this is for testing but I want to put the site live and don't know what I need to do to stop it using this.

 

Many thanks

 

Trev

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...