Jump to content
Sign in to follow this  
sashaben

Add Spaces To Credit Card Number

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

Share this post


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

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  

×