View Single Post
  #36  
Old 09-19-2007, 11:18 AM
 
virtual@croatia virtual@croatia is offline
 

Advanced Member
  
Join Date: May 2007
Posts: 92
 

Default Re: Credit Card Type +Last 4 digits on HTML Invoice

Thanks for saving my time. Here is the code for 4.1.17 version, which is much shorter and simpler:

Code:
{assign var="paren" value=$order.payment_method|strpos:' ('} {assign var="paymentMethod" value=$order.payment_method|substr:0:$paren} {if $order.payment_method eq 'Credit Card'} {php} global $order; # # 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 = ''; } 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] ) { $cc_type = parseAfterLabel( '{CardType}:', $order["details"]); $cc_num = parseAfterLabel( '{CardNumber}:', $order["details"]); $cc_mask = str_repeat( 'x', strlen( $cc_num ) ); $cc_mask = substr( $cc_mask, 0, strlen( $cc_mask ) -4 ) . substr( $cc_num, -4, 4 ); if (!empty($cc_type) || !empty($cc_mask)) echo (': ' .$cc_type. ' ' . $cc_mask); } {/php} {/if}
__________________
Check what you can do with x-cart 4.1.9:
www.smee.com

Modules I made:
IP_Ranges
Multy_Currency
Order_Dates

Modules I use:
Fancycategory
Magnifier
Survey
AOM
Reply With Quote