Please ensure you have named your Credit Card processor under 'Payment Methods' as
Credit Card; otherwise, change
Line #5 of the provided Code to match your given name, or remove the surrounding If-statement altogether.
NOTE: This has only been tested on X-Cart 4.0.18 **
http://www.home-rehab-supply.com/images/cc4dig.gif
Find
skin1/mail/html/order_invoice.tpl:
Search for
Code:
{$order.payment_method}
And replace with:
Code:
{assign var="paren" value=$order.payment_method|strpos:' ('}
{assign var="paymentMethod" value=$order.payment_method|substr:0:$paren}
{$paymentMethod}
{if $paymentMethod eq 'Credit Card'}
{php}
#
# Custom function by moneysaver67
# Retrieve Order details (decrypted) from table by Order ID
#
if( !function_exists( 'func_order_details' ) )
{
function func_order_details( $orderid )
{
global $sql_tbl;
// Grab the encrypted details
if( empty( $orderid ) ) $orderid = $GLOBALS[secure_oid][0];
$sql_orders = func_query_first("SELECT details FROM $sql_tbl[orders] WHERE orderid = $orderid");
// Return decrypted details
return text_decrypt( $sql_orders['details'] );
}
}
#
# Custom function by moneysaver67
# Parse out the info after a given label
#
if( !function_exists( 'parseAfterLabel' ) )
{
function parseAfterLabel( $label, $details )
{
// Force to one line
$details = preg_replace( '/\n/',' ', $details );
if( !stristr( $details, $label ) )
{
$return = 'N/A';
}
else
{
$pattern = '/^.*'.$label.'\s{0,}(.*)\s{0,}.*$/';
$chunk = preg_replace( $pattern, '${1}', $details );
// return everything prior to first space (auth code)
$return = substr( $chunk, 0, strpos( $chunk, ' ' ) );
}
return $return;
}
}
// Do you store CC info in the details column?
if( $GLOBALS[store_cc] )
{
$dec_details = func_order_details( $GLOBALS[orderid] );
$cc_num = parseAfterLabel( 'Card number:', $dec_details );
$cc_mask = str_repeat( 'x', strlen( $cc_num ) );
$cc_mask = substr( $cc_mask, 0, strlen( $cc_mask ) -4 ) . substr( $cc_num, -4, 4 );
echo ': ' . parseAfterLabel( 'Card type:', $dec_details ) . '
' . $cc_mask;
}
{/php}
{/if}
You now have the Credit Card Type and Last 4-digits displayed on your HTML invoices (both e-mail, and via the website Orders section!)
Also, the
(CC Processing Gateway) section is removed as well!