Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Add Spaces To Credit Card Number


sashaben

Recommended Posts

I was wondering if anyone knew how to change the credit card number details from

 

XXXXXXXXXXXXXXXX

 

To

XXXX-XXXX-XXXX-XXXX

 

Or even just

XXXX XXXX XXXX XXXX

 

It would be good if if it showed up like this both when the customer was entering the details as well as on the admin order information page. Makes it easier to read.

 

Thanks in advance for any help

Edited by sashaben
Link to comment
Share on other sites

Here is the code to do it:

 

 

in /catalog/admin/orders.php,

 

Search on the word "cc_number".

 

You will see:

 

<td class="main"><?php echo ENTRY_CREDIT_CARD_NUMBER; ?></td>

<td class="main"><?php $order->info['cc_number']; </td>

</tr>

 

Change to:

 

<td class="main"><?php echo ENTRY_CREDIT_CARD_NUMBER; ?></td>

<td class="main"><?php

 

//py: code to format cc_number with spaces

$cc_p1=substr($order->info['cc_number'],0,4);

$cc_p2=substr($order->info['cc_number'],4,4);

$cc_p3=substr($order->info['cc_number'],8,4);

$cc_p4=substr($order->info['cc_number'],12,4);

echo $cc_p1 . '-' . $cc_p2 . '-' . $cc_p3 . '-' . $cc_p4; ?></td>

</tr>

 

This will put dashes between groups of 4 numbers.

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