X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Multiple emails for order notification (https://forum.x-cart.com/showthread.php?t=63134)

minfinger 03-31-2012 08:03 PM

Multiple emails for order notification
 
Based on: http://forum.x-cart.com/showthread.php?t=34487

So I spent some time trying to figure this out and then it turned out to be much simpler than I was making it.

This is for Version 4.3.2

The following mod is for SMS text/emails. This can easily be modified to email the full notification to multiple addresses.
Instead of using:
Code:

$sms_email, "mail/order_notification_sms_subj.tpl", "mail/order_notification_sms.tpl",
use:
Code:

$sms_email, "mail/order_notification_subj.tpl", "mail/order_notification_admin.tpl",
And then make sure to change the $sms_email value to a proper email address.

STEP 1: For Processed Orders

Open include/func/func.order.php
Got to Line: 1294
PHP Code:

if ($config['Email_Note']['eml_order_p_notif_admin'] == 'Y') {
            
$to_customer $config['default_admin_language'];
            
func_send_mail($config["Company"]["orders_department"], "mail/order_notification_subj.tpl""mail/order_notification_admin.tpl"$config["Company"]["orders_department"], truetrue);
        } 


Replace code with:
PHP Code:

if ($config['Email_Note']['eml_order_p_notif_admin'] == 'Y') {
            
$to_customer $config['default_admin_language'];
            
$sms_email "10digitCellNumber@cingularme.com";       // NOTE - replace with your cellphone's SMS email address
//          func_send_mail($config["Company"]["orders_department"], "mail/order_notification_subj.tpl", "mail/order_notification_admin.tpl", $config["Company"]["orders_department"], true, true);    // NOTE - Uncomment this line if you would like to receive BOTH SMS and Email initial order notifications
            
func_send_mail($sms_email"mail/order_notification_sms_subj.tpl""mail/order_notification_sms.tpl"$config["Company"]["orders_department"], truetrue);    // NOTE - send processed order alert to cellphone via SMS
        



Version 2 (Optional)
STEP 1: For Initial Order notification to the Order Department

Open include/func/func.order.php
Goto Line 1493
PHP Code:

if ($config["Email_Note"]["enable_order_notif"]) {
        
$mail_smarty->assign("show_order_details""Y");
        
func_send_mail($config["Company"]["orders_department"], "mail/preauth_order_notification_subj.tpl""mail/preauth_order_notification.tpl"$userinfo["email"], truetrue);
        
$mail_smarty->assign("show_order_details""");
    } 


Replace with:
PHP Code:

if ($config["Email_Note"]["enable_order_notif"]) {
        
$mail_smarty->assign("show_order_details""Y");
        
$sms_email "10digitCellNumber@cingularme.com";       // NOTE - replace with your cellphone's SMS email address
        
func_send_mail($config["Company"]["orders_department"], "mail/preauth_order_notification_subj.tpl""mail/preauth_order_notification.tpl"$userinfo["email"], truetrue);
        
func_send_mail($sms_email"mail/order_notification_sms_subj.tpl",  "mail/order_notification_sms.tpl",  $config["Company"]["orders_department"], truetrue);    // NOTE - send  processed order alert to cellphone via SMS
        
$mail_smarty->assign("show_order_details""");
    } 


STEP 2 (SMS email subject line):

Create New File (in skin1/mail folder): order_notification_sms_subj.tpl

File Contents:
Code:

{* NOTE Custom MOD File - For SMS Cellphone Text Order Notification - You may hard-code anything into this Subject line that you see fit *}
{config_load file="$skin_config"}{ $config.Company.company_name }: {$lng.lbl_order} #{$order.orderid}


STEP 3 (SMS email body line):

Create New File (in skin1/mail folder): order_notification_sms.tpl

File Contents:
Code:

{* NOTE Custom MOD File - SMS Notification to Admin via cellphone *}
{config_load file="$skin_config"}
{assign var=where value="A"}
{if $customer ne ''}{assign var="_userinfo" value=$customer}{else}{assign var="_userinfo" value=$userinfo}{/if}
{config_load file="$skin_config"}

&nbsp;<BR>
{$order.firstname} {$order.lastname}<BR>
{$order.phone}<BR>
{$order.s_statename}<BR>
<BR>
{foreach from=$products item=product}
{$product.productcode} ({$product.amount})<br>
{/foreach}
<BR>
{$lng.lbl_total}: {include file="currency.tpl" value=$order.total}


The above message body code shows the Order Number, Customer Name, Customer Phone, Customer State, Each Product SKU (Quantity), and Order Total Amount ($). Comment out those you do not wish displayed, or add other variables you would like to see. Just remember you only have about 150-160 characters per SMS alert message.

Please let me know if you find this useful. I haven't tested it in the newest version of X-Cart, but once you find the matching old code, then inserting the new SMS code should be a snap.

Tested on X-Cart 4.3.2

I tested this to one of my other email accounts that was different than my test account, before linking it to the SMS email of the phone I wanted to use.

Here's a list of SMS address per carrier:

HERE IS A LIST OF SOME POPULAR SMS EMAIL ADDRESS FORMATS:
Alltel: phonenumber@message.alltel.com
AT&T Wireless: (now Cingular): phonenumber@mmode.com
Boost Mobile: phonenumber@myboostmobile.com
Cingular: phonenumber@cingularme.com
Metro PCS: phonenumber@mymetropcs.com
Nextel: phonenumber@messaging.nextel.com
Ntelos: phonenumber@pcs.ntelos.net
Orange: phonenumber@orange.net
Sprint (now Sprint Nextel): phonenumber@messaging.sprintpcs.com
T-Mobile: phonenumber@tmomail.net
US Cellular: 10digit number@email.uscc.net
Verizon: phonenumber@vtext.com
Virgin Mobile: phonenumber@vmobl.com

Vacman 05-05-2012 06:58 AM

Re: Multiple emails for order notification
 
I thought about doing this and found your code. I have checked to make sure that I did everything.

I am only running the Processed Orders version (1st one), and although I still get my email notifications, it does not send out the text message.

BTW - as a test, I wrote a simple php script with an input form, just to make sure that my carrier works - and it does.

This is the code (xxxx = my phone number):
mail("xxxxxxxxxx@txt.att.net", "", $message, "From: Carl\r\n");

minfinger 05-05-2012 07:45 AM

Re: Multiple emails for order notification
 
Thanks Carl, I know how it works.

But I didn't add anything to my code other than what I posted above.

And as far as working with the carrier, it's a myth that you need a program or connector to send emails to cell phones through their SMS@mobile.com address. There are other reason to have a connector, but it is not required in this instance.

Instead of putting the SMS text message email address in the $smsmail field, try using an alternative email address.

One of the problems I ran into was that my X-cart configuration did not send out emails for processed notifications. Initial Order Notification was the way mine was configured.

Mike

Vacman 05-05-2012 01:10 PM

Re: Multiple emails for order notification
 
OK - Will look into that and get back to you. In the meantime, I just put my generic text line of code into the function to check to see if it works.

I will report back what I find.


All times are GMT -8. The time now is 02:01 PM.

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