X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Credit Card Type +Last 4 digits on HTML Invoice (https://forum.x-cart.com/showthread.php?t=23350)

moneysaver67 07-17-2006 11:13 AM

Credit Card Type +Last 4 digits on HTML Invoice
 
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!

alru111 07-18-2006 07:29 AM

very useful, thanks
will test asap

moneysaver67 07-18-2006 03:19 PM

How'd your test go??

alru111 07-22-2006 03:09 PM

order confirmation page of the website looks fine
but the html invoice email gives an sql error

INVALID SQL: 0 :
SQL QUERY FAILURE: SELECT details FROM xcart_orders WHERE orderid =
: N/AxxN/A

alru111 07-22-2006 03:42 PM

the error appears on the confirmation email to the seller.

more details on the error


Request URI : ../payment/payment_cc.php
SQL query : SELECT details FROM xcart_orders WHERE orderid =
Error code : 1064

moneysaver67 07-23-2006 10:27 AM

Quote:

Originally Posted by alru111
the error appears on the confirmation email to the seller.

more details on the error


Request URI : ../payment/payment_cc.php
SQL query : SELECT details FROM xcart_orders WHERE orderid =
Error code : 1064


You may have grabbed the previous version of the code. I noticed this error and updated my first post.

Please check that your code contains

Code:

          if( empty( $orderid ) ) $orderid = $GLOBALS[secure_oid][0]; 

So it should look like this:

Code:


function func_order_details( $orderid )
      {
          global $sql_tbl;
          // Grab the encrypted details
           
          if( empty( $orderid ) ) $orderid = $GLOBALS[secure_oid][0]; 

          ...


carpeperdiem 07-30-2006 03:30 PM

Dear moneysaver,

I tried this mod w/ 4.0.18 and I am not able to get it working...

I experienced an error right after the "submit..."
Code:

Your order is being placed. Please wait...


:


Parse error: parse error, unexpected T_STRING in /htdocs/mommymakeup.com/xcart/templates_c/%%E6^E62^E6283DF6%%order_invoice.tpl.php on line 67


FYI, line 67 of my order_invoice.tpl is the above mentioned,
Code:

if( empty( $orderid ) ) $orderid = $GLOBALS[secure_oid][0];
Hmm... any idea why this isn't working for me?

Here's my COMPLETE order_invoice.tpl:
Code:

{* $Id: order_invoice.tpl,v 1.14.2.16 2005/11/17 08:41:18 max Exp $ *}
{if $customer ne ''}{assign var="_userinfo" value=$customer}{else}{assign var="_userinfo" value=$userinfo}{/if}
{config_load file="$skin_config"}
{if $is_nomail ne 'Y'}
{literal}
<STYLE type="text/css">
BODY {
        MARGIN-TOP: 10px;
        FONT-SIZE: 12px;
        MARGIN-LEFT: 10px;
        FONT-FAMILY: arial,helvetica,sans-serif
}
TD {
        FONT-SIZE: 12px;
        FONT-FAMILY: arial,helvetica,sans-serif
}
TH {
        FONT-SIZE: 13px;
        FONT-FAMILY: arial,helvetica,sans-serif
}
H1 {
    FONT-SIZE: 20px
}
</STYLE>
{/literal}



{/if}
<TABLE cellSpacing="0" cellPadding="0" width="{if $is_nomail eq 'Y'}100%{else}600{/if}" border="0" bgColor="#ffffff" color="#000000">
<TR>
        <TD>
        <TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
        <TR>
                <TD valign="top">

[img]{$ImagesDir}/companyname_small.gif[/img]</TD>
                <TD width="100%">
                <TABLE cellSpacing="0" cellPadding="2" width="100%" border="0">
                <TR>
                        <TD width="30"></TD>
                        <TD vAlign="top">
<FONT style="FONT-SIZE: 28px"><B style="text-transform: uppercase;">{$lng.lbl_invoice}[/b]</FONT>



{$lng.lbl_date}: {$order.date|date_format:$config.Appearance.datetime_format}
{$lng.lbl_order_id}: #{$order.orderid}
{$lng.lbl_order_status}: {include file="main/order_status.tpl" status=$order.status mode="static"}

{$lng.lbl_payment_method}:


{* BEGIN remove credit card ex-last 4 mod *}
{* {$order.payment_method} *}
{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,}.*$/i';
б═ б═б═ б═б═ б═б═ б═$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}
{* END remove credit card ex-last 4 mod *}



{$lng.lbl_delivery}:{$order.shipping|trademark|default:$lng.txt_not_available}
                        </TD>
                        <TD vAlign="bottom" align="right">
{$config.Company.company_name}
{$config.Company.location_address}

                                                                        {$config.Company.location_city},{$config.Company.location_state}{$config.Company.location_zipcode}

                                                                       
{$config.Company.location_country_name}

{if $config.Company.company_phone}{$lng.lbl_phone_1_title}: {$config.Company.company_phone}
{/if}
{if $config.Company.company_phone_2}{$lng.lbl_phone_2_title}: {$config.Company.company_phone_2}
{/if}
{if $config.Company.company_fax}{$lng.lbl_fax}: {$config.Company.company_fax}
{/if}
{if $config.Company.orders_department}{* {$lng.lbl_email}: *}{$config.Company.orders_department}
{/if}
{if $order.applied_taxes}


{foreach from=$order.applied_taxes key=tax_name item=tax}
{$tax.regnumber}

{/foreach}
{/if}
                        </TD>
                </TR>
                </TABLE>
                </TD>
        </TR>
        </TABLE>
        <TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
        <TR>
                <TD>[img]{$ImagesDir}/spacer.gif[/img]</TD>
        </TR>
        <TR>
                <TD bgcolor="#000000">[img]{$ImagesDir}/spacer_black.gif[/img]</TD>
        </TR>
        <TR>
                <TD>[img]{$ImagesDir}/spacer.gif[/img]</TD>
        </TR>
        </TABLE>
       

{* BEGIN FORMATTING MOD *}       
<TABLE cellSpacing="0" cellPadding="0" width="45%" border="0">
{if $_userinfo.default_fields.company}
        <TR>
                <TD>{$lng.lbl_company}:</TD>
                <TD>{$order.company}</TD>
        </TR>
{/if}
{if $_userinfo.default_fields.firstname}
        <TR>
                <TD noWrap>Name:</TD>
                <TD>{$order.firstname} {$order.lastname}</TD>
        </TR>                       
{/if}
{if $_userinfo.default_fields.lastname}

{/if}
{if $_userinfo.default_fields.phone}
<TR>
                <TD>{$lng.lbl_phone}:</TD>
                <TD>{$order.phone}</TD>
        </TR>
{/if}
{if $_userinfo.default_fields.fax}
        <TR>
<TD>{$lng.lbl_fax}:</TD>
                <TD>{$order.fax}</TD>
        </TR>
{/if}
{if $_userinfo.default_fields.email}
        <TR>
                <TD>{$lng.lbl_email}:</TD>
                <TD>{$order.email}</TD>
        </TR>
{/if}
{if $_userinfo.default_fields.url}
        <TR>
                <TD>{$lng.lbl_url}:</TD>
                <TD>{$order.url}</TD>
        </TR>
{/if}
{foreach from=$_userinfo.additional_fields item=v}
{if $v.section eq 'C' || $v.section eq 'P'}
        <TR>
                <TD>{$v.title}:</TD>
        <TD>{$v.value}</TD>
        </TR>
        {/if}
{/foreach}
        </TABLE>
       

        <TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
        <TR>
                <TD width="45%" height="25">{$lng.lbl_billing_address}</TD>
                <TD width="10%"></TD>
                <TD width="45%" height="25">{$lng.lbl_shipping_address}</TD>
        </TR>
        <TR>
                <TD bgColor="#000000" height="2">[img]{$ImagesDir}/spacer_black.gif[/img]</TD>
                <TD>[img]{$ImagesDir}/spacer.gif[/img]</TD>
                <TD bgColor="#000000" height="2">[img]{$ImagesDir}/spacer_black.gif[/img]</TD>
        </TR>
        <TR>
                <TD colSpan="3">[img]{$ImagesDir}/spacer.gif[/img]</TD>
        </TR>
        <TR>
                <TD>
                <TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
{if $_userinfo.default_fields.firstname}
                <TR>
                                                                <TD>{$order.b_firstname} {$order.b_lastname}</TD>
                                                        </TR>
                                                       
{/if}
{if $_userinfo.default_fields.lastname}

{/if}
{if $_userinfo.default_fields.b_address}

                                                        <TR>
                                                                <TD>{$order.b_address}
{$order.b_address_2}</TD>
                                                        </TR>
{/if}
{if $_userinfo.default_fields.b_city}
                <TR>
                                                                <TD>{$order.b_city},{$order.b_state}{$order.b_zipcode}</TD>
                                                        </TR>
{/if}
{if $_userinfo.default_fields.b_county && $config.General.use_counties eq 'Y'}
                <TR>
                                                                <TD>{$order.b_countyname}</TD>
                                                        </TR>
                                                       
{/if}
{if $_userinfo.default_fields.b_state}

{/if}
{if $_userinfo.default_fields.b_country}

                                                        <TR>
                                                                <TD>{$order.b_countryname}</TD>
                                                        </TR>
                                                       
{/if}
{if $_userinfo.default_fields.b_zipcode}

{/if}
{foreach from=$_userinfo.additional_fields item=v}
{if $v.section eq 'B'}

                                                        <TR>
                                                                <TD>{$v.value}</TD>
                                                        </TR>
        {/if}
{/foreach}
                </TABLE>
                </TD>
                <TD></TD>
                <TD>
                <TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
{if $_userinfo.default_fields.firstname}
                <TR>
                                                                <TD>{$order.s_firstname} {$order.s_lastname}</TD>
                                                        </TR>
                                                       
{/if}
{if $_userinfo.default_fields.lastname}

{/if}
{if $_userinfo.default_fields.s_address}

                                                        <TR>
                                                                <TD>{$order.s_address}
{$order.s_address_2}</TD>
                                                        </TR>
{/if}
{if $_userinfo.default_fields.s_city}
                <TR><TD>{$order.s_city},{$order.s_state}{$order.s_zipcode}</TD>
                                                        </TR>
{/if}
{if $_userinfo.default_fields.s_county && $config.General.use_counties eq 'Y'}
                <TR>
                                                                <TD>{$order.s_countyname}</TD>
                                                        </TR>                                               
{/if}
{if $_userinfo.default_fields.s_state}
{/if}
{if $_userinfo.default_fields.s_country}
<TR>
                                                                <TD>{$order.s_countryname}</TD>
                                                        </TR>                                                       
{/if}
{if $_userinfo.default_fields.s_zipcode}

{/if}
{foreach from=$_userinfo.additional_fields item=v}
{if $v.section eq 'S'}

                                                        <TR>
                                                                <TD>{$v.value}</TD>
                                                        </TR>
        {/if}
{/foreach}
                </TABLE>
{* END FORMATTING MOD *}               
        </TD>
        </TR>

{assign var="is_header" value=""}
{foreach from=$_userinfo.additional_fields item=v}
{if $v.section eq 'A'}
{if $is_header eq ''}
<TR>
        <TD colspan="3"></TD>
</TR>
<TR>
        <TD width="45%" height="25">{$lng.lbl_additional_information}</TD>
        <TD colspan="2" width="55%"></TD>
</TR>
<TR>
        <TD bgColor="#000000" height="2">[img]{$ImagesDir}/spacer_black.gif[/img]</TD>
        <TD colspan="2" width="55%">[img]{$ImagesDir}/spacer.gif[/img]</TD>
</TR>
<TR>
        <TD colSpan="3">[img]{$ImagesDir}/spacer.gif[/img]</TD>
</TR>
<TR>
        <TD><TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
{assign var="is_header" value="E"}
{/if}
<TR valign="top">
        <TD>{$v.title}</TD>
          <TD>{$v.value}</TD>
</TR>
{/if}
{/foreach}
{if $is_header eq 'E'}
</TABLE></TD>
<TD colspan="2" width="55%"></TD>
</TR>
{/if}


{if $config.Email.show_cc_info eq "Y" and $show_order_details eq "Y"}

        <TR>
        <TD colspan="3"></TD>
        </TR>

        <TR>
        <TD width="45%" height="25">{$lng.lbl_order_payment_details}</TD>
        <TD colspan="2" width="55%"></TD>
        </TR>
       
        <TR>
        <TD bgColor="#000000" height="2">[img]{$ImagesDir}/spacer_black.gif[/img]</TD>
        <TD colspan="2">[img]{$ImagesDir}/spacer.gif[/img]</TD>
        <TR>
        <TD colSpan="3">[img]{$ImagesDir}/spacer.gif[/img]</TD>
        </TR>

        <TR>
        <TD colspan="3">{$order.details|replace:"\n":"
"}</TD>
        </TR>

{/if}
{if $order.netbanx_reference}
<TR>
        <TD colspan="3">NetBanx Reference: {$order.netbanx_reference}</TD>
</TR>
{/if}

        </TABLE>
       

       


{include file="mail/html/order_data.tpl"}

        </TD>
</TR>
{if $active_modules.Anti_Fraud eq '' && $show_order_details eq "Y" && ($usertype eq 'A' || ($usertype eq 'P' && $active_modules.Simple_Mode))}
<TR>
        <TD align="center">
{$lng.txt_warning_antifraud_disabled}
</TD>
</TR>
{/if}
<TR>
<TD align="center">

<FONT style="FONT-SIZE:12px">{$lng.txt_thank_you_for_purchase}</FONT></TD>
</TR>

</TABLE>


moneysaver67 07-30-2006 04:01 PM

Did you copy and paste from Safari, causing any potential white space issues etc?

What ACTIVE payment methods do you offer?

What are their names, as defined in the admin section of x-cart?

carpeperdiem 07-30-2006 04:11 PM

Quote:

Originally Posted by moneysaver67
Did you copy and paste from Safari, causing any potential white space issues etc?

What ACTIVE payment methods do you offer?

What are their names, as defined in the admin section of x-cart?


Is Safari THAT BAD? OK -- I'm going to Firefox right now... well WHADDA YOU KNOW! Wow, that's a great mod! Moneysaver, you now have 2 superb mods -- any others?

I need to put a big old sign above my monitor: DO NOT COPY/PASTE CODE WITH SAFARI

I am going to go back and edit my previous post and get rid of the so-called "bad" Safari generated code.

Thank you for pointing this out.

Jeremy

carpeperdiem 07-30-2006 04:18 PM

Not so fast....

The on-screen oder confirmation is perfect, HOWEVER...

SQL error email to admin:
Code:

SQL query  : SELECT details FROM xcart_orders WHERE orderid =
Error code  : 1064
Description :

You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Backtrace  :
/xcart/include/func.php:121
/xcart/include/func.php:80
/xcart/include/func.php:187
/xcart/templates_c/%%E6^E62^E6283DF6%%order_invoice.tpl.php:82
/xcart/templates_c/%%E6^E62^E6283DF6%%order_invoice.tpl.php:122
/xcart/Smarty-2.6.9/Smarty.class.php:1861
/xcart/templates_c/%%43^431^431F4BBB%%order_customer.tpl.php:26
/xcart/Smarty-2.6.9/Smarty.class.php:1861
/xcart/templates_c/%%6E^6EF^6EF88A98%%html_message_template.tpl.php:6
/xcart/Smarty-2.6.9/Smarty.class.php:1258
/xcart/include/templater/templater.php:60
/xcart/include/func.php:5286
/xcart/include/func.php:332
/xcart/include/func.php:3144
/xcart/payment/payment_cc.php:151


email notification to customer:

Code:

Order status: Queued
Payment method:
Credit Card INVALID SQL: 0 :
SQL QUERY FAILURE: SELECT details FROM xcart_orders WHERE orderid =
: N/A
xxN/A 

AND email notification to the admin had the full credit card number...

Hmm....

Any ideas?

order_invoice.tpl is now:
Code:

{* $Id: order_invoice.tpl,v 1.14.2.16 2005/11/17 08:41:18 max Exp $ *}
{if $customer ne ''}{assign var="_userinfo" value=$customer}{else}{assign var="_userinfo" value=$userinfo}{/if}
{config_load file="$skin_config"}
{if $is_nomail ne 'Y'}
{literal}
<STYLE type="text/css">
BODY {
        MARGIN-TOP: 10px;
        FONT-SIZE: 12px;
        MARGIN-LEFT: 10px;
        FONT-FAMILY: arial,helvetica,sans-serif
}
TD {
        FONT-SIZE: 12px;
        FONT-FAMILY: arial,helvetica,sans-serif
}
TH {
        FONT-SIZE: 13px;
        FONT-FAMILY: arial,helvetica,sans-serif
}
H1 {
    FONT-SIZE: 20px
}
</STYLE>
{/literal}



{/if}
<TABLE cellSpacing="0" cellPadding="0" width="{if $is_nomail eq 'Y'}100%{else}600{/if}" border="0" bgColor="#ffffff" color="#000000">
<TR>
        <TD>
        <TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
        <TR>
                <TD valign="top">

[img]{$ImagesDir}/companyname_small.gif[/img]</TD>
                <TD width="100%">
                <TABLE cellSpacing="0" cellPadding="2" width="100%" border="0">
                <TR>
                        <TD width="30"></TD>
                        <TD vAlign="top">
<FONT style="FONT-SIZE: 28px"><B style="text-transform: uppercase;">{$lng.lbl_invoice}[/b]</FONT>



{$lng.lbl_date}: {$order.date|date_format:$config.Appearance.datetime_format}
{$lng.lbl_order_id}: #{$order.orderid}
{$lng.lbl_order_status}: {include file="main/order_status.tpl" status=$order.status mode="static"}

{$lng.lbl_payment_method}:


{* BEGIN remove credit card ex-last 4 mod *}
{* {$order.payment_method} *}
{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,}.*$/i';
            $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}
{* END remove credit card ex-last 4 mod *}



{$lng.lbl_delivery}:{$order.shipping|trademark|default:$lng.txt_not_available}
                        </TD>
                        <TD vAlign="bottom" align="right">
{$config.Company.company_name}
{$config.Company.location_address}

                                                                        {$config.Company.location_city},{$config.Company.location_state}{$config.Company.location_zipcode}

                                                                       
{$config.Company.location_country_name}

{if $config.Company.company_phone}{$lng.lbl_phone_1_title}: {$config.Company.company_phone}
{/if}
{if $config.Company.company_phone_2}{$lng.lbl_phone_2_title}: {$config.Company.company_phone_2}
{/if}
{if $config.Company.company_fax}{$lng.lbl_fax}: {$config.Company.company_fax}
{/if}
{if $config.Company.orders_department}{* {$lng.lbl_email}: *}{$config.Company.orders_department}
{/if}
{if $order.applied_taxes}


{foreach from=$order.applied_taxes key=tax_name item=tax}
{$tax.regnumber}

{/foreach}
{/if}
                        </TD>
                </TR>
                </TABLE>
                </TD>
        </TR>
        </TABLE>
        <TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
        <TR>
                <TD>[img]{$ImagesDir}/spacer.gif[/img]</TD>
        </TR>
        <TR>
                <TD bgcolor="#000000">[img]{$ImagesDir}/spacer_black.gif[/img]</TD>
        </TR>
        <TR>
                <TD>[img]{$ImagesDir}/spacer.gif[/img]</TD>
        </TR>
        </TABLE>
       

{* BEGIN FORMATTING MOD *}       
<TABLE cellSpacing="0" cellPadding="0" width="45%" border="0">
{if $_userinfo.default_fields.company}
        <TR>
                <TD>{$lng.lbl_company}:</TD>
                <TD>{$order.company}</TD>
        </TR>
{/if}
{if $_userinfo.default_fields.firstname}
        <TR>
                <TD noWrap>Name:</TD>
                <TD>{$order.firstname} {$order.lastname}</TD>
        </TR>                       
{/if}
{if $_userinfo.default_fields.lastname}

{/if}
{if $_userinfo.default_fields.phone}
<TR>
                <TD>{$lng.lbl_phone}:</TD>
                <TD>{$order.phone}</TD>
        </TR>
{/if}
{if $_userinfo.default_fields.fax}
        <TR>
<TD>{$lng.lbl_fax}:</TD>
                <TD>{$order.fax}</TD>
        </TR>
{/if}
{if $_userinfo.default_fields.email}
        <TR>
                <TD>{$lng.lbl_email}:</TD>
                <TD>{$order.email}</TD>
        </TR>
{/if}
{if $_userinfo.default_fields.url}
        <TR>
                <TD>{$lng.lbl_url}:</TD>
                <TD>{$order.url}</TD>
        </TR>
{/if}
{foreach from=$_userinfo.additional_fields item=v}
{if $v.section eq 'C' || $v.section eq 'P'}
        <TR>
                <TD>{$v.title}:</TD>
        <TD>{$v.value}</TD>
        </TR>
        {/if}
{/foreach}
        </TABLE>
       

        <TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
        <TR>
                <TD width="45%" height="25">{$lng.lbl_billing_address}</TD>
                <TD width="10%"></TD>
                <TD width="45%" height="25">{$lng.lbl_shipping_address}</TD>
        </TR>
        <TR>
                <TD bgColor="#000000" height="2">[img]{$ImagesDir}/spacer_black.gif[/img]</TD>
                <TD>[img]{$ImagesDir}/spacer.gif[/img]</TD>
                <TD bgColor="#000000" height="2">[img]{$ImagesDir}/spacer_black.gif[/img]</TD>
        </TR>
        <TR>
                <TD colSpan="3">[img]{$ImagesDir}/spacer.gif[/img]</TD>
        </TR>
        <TR>
                <TD>
                <TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
{if $_userinfo.default_fields.firstname}
                <TR>
                                                                <TD>{$order.b_firstname} {$order.b_lastname}</TD>
                                                        </TR>
                                                       
{/if}
{if $_userinfo.default_fields.lastname}

{/if}
{if $_userinfo.default_fields.b_address}

                                                        <TR>
                                                                <TD>{$order.b_address}
{$order.b_address_2}</TD>
                                                        </TR>
{/if}
{if $_userinfo.default_fields.b_city}
                <TR>
                                                                <TD>{$order.b_city},{$order.b_state}{$order.b_zipcode}</TD>
                                                        </TR>
{/if}
{if $_userinfo.default_fields.b_county && $config.General.use_counties eq 'Y'}
                <TR>
                                                                <TD>{$order.b_countyname}</TD>
                                                        </TR>
                                                       
{/if}
{if $_userinfo.default_fields.b_state}

{/if}
{if $_userinfo.default_fields.b_country}

                                                        <TR>
                                                                <TD>{$order.b_countryname}</TD>
                                                        </TR>
                                                       
{/if}
{if $_userinfo.default_fields.b_zipcode}

{/if}
{foreach from=$_userinfo.additional_fields item=v}
{if $v.section eq 'B'}

                                                        <TR>
                                                                <TD>{$v.value}</TD>
                                                        </TR>
        {/if}
{/foreach}
                </TABLE>
                </TD>
                <TD></TD>
                <TD>
                <TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
{if $_userinfo.default_fields.firstname}
                <TR>
                                                                <TD>{$order.s_firstname} {$order.s_lastname}</TD>
                                                        </TR>
                                                       
{/if}
{if $_userinfo.default_fields.lastname}

{/if}
{if $_userinfo.default_fields.s_address}

                                                        <TR>
                                                                <TD>{$order.s_address}
{$order.s_address_2}</TD>
                                                        </TR>
{/if}
{if $_userinfo.default_fields.s_city}
                <TR><TD>{$order.s_city},{$order.s_state}{$order.s_zipcode}</TD>
                                                        </TR>
{/if}
{if $_userinfo.default_fields.s_county && $config.General.use_counties eq 'Y'}
                <TR>
                                                                <TD>{$order.s_countyname}</TD>
                                                        </TR>                                               
{/if}
{if $_userinfo.default_fields.s_state}
{/if}
{if $_userinfo.default_fields.s_country}
<TR>
                                                                <TD>{$order.s_countryname}</TD>
                                                        </TR>                                                       
{/if}
{if $_userinfo.default_fields.s_zipcode}

{/if}
{foreach from=$_userinfo.additional_fields item=v}
{if $v.section eq 'S'}

                                                        <TR>
                                                                <TD>{$v.value}</TD>
                                                        </TR>
        {/if}
{/foreach}
                </TABLE>
{* END FORMATTING MOD *}               
        </TD>
        </TR>

{assign var="is_header" value=""}
{foreach from=$_userinfo.additional_fields item=v}
{if $v.section eq 'A'}
{if $is_header eq ''}
<TR>
        <TD colspan="3"></TD>
</TR>
<TR>
        <TD width="45%" height="25">{$lng.lbl_additional_information}</TD>
        <TD colspan="2" width="55%"></TD>
</TR>
<TR>
        <TD bgColor="#000000" height="2">[img]{$ImagesDir}/spacer_black.gif[/img]</TD>
        <TD colspan="2" width="55%">[img]{$ImagesDir}/spacer.gif[/img]</TD>
</TR>
<TR>
        <TD colSpan="3">[img]{$ImagesDir}/spacer.gif[/img]</TD>
</TR>
<TR>
        <TD><TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
{assign var="is_header" value="E"}
{/if}
<TR valign="top">
        <TD>{$v.title}</TD>
          <TD>{$v.value}</TD>
</TR>
{/if}
{/foreach}
{if $is_header eq 'E'}
</TABLE></TD>
<TD colspan="2" width="55%"></TD>
</TR>
{/if}


{if $config.Email.show_cc_info eq "Y" and $show_order_details eq "Y"}

        <TR>
        <TD colspan="3"></TD>
        </TR>

        <TR>
        <TD width="45%" height="25">{$lng.lbl_order_payment_details}</TD>
        <TD colspan="2" width="55%"></TD>
        </TR>
       
        <TR>
        <TD bgColor="#000000" height="2">[img]{$ImagesDir}/spacer_black.gif[/img]</TD>
        <TD colspan="2">[img]{$ImagesDir}/spacer.gif[/img]</TD>
        <TR>
        <TD colSpan="3">[img]{$ImagesDir}/spacer.gif[/img]</TD>
        </TR>

        <TR>
        <TD colspan="3">{$order.details|replace:"\n":"
"}</TD>
        </TR>

{/if}
{if $order.netbanx_reference}
<TR>
        <TD colspan="3">NetBanx Reference: {$order.netbanx_reference}</TD>
</TR>
{/if}

        </TABLE>
       

       


{include file="mail/html/order_data.tpl"}

        </TD>
</TR>
{if $active_modules.Anti_Fraud eq '' && $show_order_details eq "Y" && ($usertype eq 'A' || ($usertype eq 'P' && $active_modules.Simple_Mode))}
<TR>
        <TD align="center">
{$lng.txt_warning_antifraud_disabled}
</TD>
</TR>
{/if}
<TR>
<TD align="center">

<FONT style="FONT-SIZE:12px">{$lng.txt_thank_you_for_purchase}</FONT></TD>
</TR>

</TABLE>



All times are GMT -8. The time now is 06:52 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.