Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

How to add SMS notification

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 10-09-2007, 08:38 PM
 
instinct instinct is offline
 

Newbie
  
Join Date: Aug 2007
Posts: 6
 

Default How to add SMS notification

Dear friends,

Please help me with tips on how to add Short Messaging Service notifications to my X-Cart store.
__________________
change is constant
X-cart 4.1.8
Drop Shipping webfront
Reply With Quote
  #2  
Old 11-02-2007, 09:24 AM
 
robertswww robertswww is offline
 

X-Adept
  
Join Date: Jul 2003
Posts: 586
 

Default Re: How to add SMS notification

Hello Instinct,

I needed this capability as well, so I figured out how to code it in X-Cart 4.0.19. Consider it another gift back to the wonderful X-Cart forums community.

Description: This code will allow you to send a SMS text message to a Cellphone when the order is received.

This is a great way for your site owner or admin to keep tabs on incoming sales even when they are away from the office.

Short Messaging Service (SMS) typically allows 150 to 160 characters maximum per message. You will need a cellphone and a subscription from your cellphone provider to receive text messages. Rates vary among providers. Some charge by message, other by kilobyte and others offer unlimited messaging plans.

NOTE: There are 2 versions of the (Step 1) code below... SMS initial order notifications, or SMS processed order notifications.

It's always advisable to backup any files you will be modifying.

Version 1: SMS Initial Order Notifications to Orders Department (i.e. Admin).
Advantage: You can turn the SMS messages on and off via the initial orders notifications setting in the Admin --> General Settings --> Email Notifications Options

STEP 1:

Locate file: include/func.php (for 4.0.x)... for 4.1.x, make the MODs to file: include/func/func.order.php (note that the line numbers will be different, but code is the same)

Locate Code (Line 3206):
Code:
# Notify orders department by email # $mail_smarty->assign("show_order_details", "Y"); func_send_mail($config["Company"]["orders_department"], "mail/".$prefix."order_notification_subj.tpl", "mail/order_notification_admin.tpl", $userinfo["email"], true, true); $mail_smarty->assign("show_order_details", "");


Replace with this Code (2 lines added):
Code:
# Notify orders department by email # $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/".$prefix."order_notification_subj.tpl", "mail/order_notification_admin.tpl", $userinfo["email"], 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"], false); // NOTE - send initial order alert to cellphone via SMS $mail_smarty->assign("show_order_details", "");


Version 2 (Optional):

If you would prefer SMS cellphone alerts only for Processed orders and not Initial orders, then use this code instead of the code above, and you will get an SMS alert in addition to your normal Email Notification:

Locate Code (Line 3463):
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"], true, true); }
Replace with this Code:
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 - Original send Main Order Notification to Admin via email func_send_mail($sms_email, "mail/order_notification_sms_subj.tpl", "mail/order_notification_sms.tpl", $config["Company"]["orders_department"], false); // NOTE - send processed order alert to cellphone via SMS }
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/html 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.0.19

Robert

P.S. Maybe one of the site moderators can move this to the Completed MODs section.
__________________
X-cart 4.1.10
Reply With Quote

The following user thanks robertswww for this useful post:
DavyMac (04-18-2012)
  #3  
Old 08-22-2009, 12:24 AM
 
Learner Learner is offline
 

X-Adept
  
Join Date: Dec 2008
Posts: 807
 

Default Re: How to add SMS notification

[quote

Code:
# Notify orders department by email # $mail_smarty->assign("show_order_details", "Y"); $sms_email = "10digitCellNumber@cingularme.com"; // NOTE - replace with your cellphone's SMS email address

[/quote]

Hi Robert Thanks for your codes.

Two questions
1)what do you mean by
$sms_email = "10digitCellNumber@cingularme.com";?

2)Also when a customer places order,is it possible to send SMS to each of the registered customer's ordered product?

Can you help me?

Thank you.
__________________
4.6.1 Platinum


Reply With Quote
  #4  
Old 08-24-2009, 11:08 AM
 
robertswww robertswww is offline
 

X-Adept
  
Join Date: Jul 2003
Posts: 586
 

Default Re: How to add SMS notification

Quote:
Originally Posted by Learner
Two questions
1)what do you mean by
$sms_email = "10digitCellNumber@cingularme.com";?

2)Also when a customer places order,is it possible to send SMS to each of the registered customer's ordered product?
Hi Learner,

In regards to your question 1, just enter your Cell Phone Number and Wireless Carrier's SMS address. For example:

If you use T-Mobile...
$sms_email = "1234567890@tmomail.net";

(note: of course, you would type in your personal 10-digit phone number)

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

---

In regards to your question 2, if you would also like the SMS message to go to the customer... I have not tried that yet, but here is an idea:

First add some code to collect the customer's SMS address during checkout (i.e. cell phone number with carrier's sms domain). Assign this to the variable $customer_sms_email;

Next, look in include/func/func.order.php and find the line were the Order Processed Email is sent to the customer:
Code:
func_send_mail($userinfo["email"], "mail/order_cust_processed_subj.tpl", $mail_body_template, $config["Company"]["orders_department"], false);

Then, just add the same SMS code to that section, as shown in my Version 2 in Post #2 above, but modified for $customer_sms_email
Code:
$customer_sms_email = "10digitCellNumber@cingularme.com"; func_send_mail($customer_sms_email, "mail/order_notification_sms_subj.tpl", "mail/order_notification_sms.tpl", $config["Company"]["orders_department"], false);

As I said, I have not tried that version yet, so just do some testing on a test site until you getting working the way you want with some test orders.

Robert
__________________
X-cart 4.1.10
Reply With Quote
  #5  
Old 08-25-2009, 04:41 AM
 
Learner Learner is offline
 

X-Adept
  
Join Date: Dec 2008
Posts: 807
 

Default Re: How to add SMS notification

Quote:
Originally Posted by robertswww
Hi Learner,


In regards to your question 2, if you would also like the SMS message to go to the customer... I have not tried that yet, but here is an idea:

First add some code to collect the customer's SMS address during checkout (i.e. cell phone number with carrier's sms domain). Assign this to the variable $customer_sms_email;

Next, look in include/func/func.order.php and find the line were the Order Processed Email is sent to the customer:
Code:
func_send_mail($userinfo["email"], "mail/order_cust_processed_subj.tpl", $mail_body_template, $config["Company"]["orders_department"], false);

Then, just add the same SMS code to that section, as shown in my Version 2 in Post #2 above, but modified for $customer_sms_email
Code:
$customer_sms_email = "10digitCellNumber@cingularme.com"; func_send_mail($customer_sms_email, "mail/order_notification_sms_subj.tpl", "mail/order_notification_sms.tpl", $config["Company"]["orders_department"], false);

As I said, I have not tried that version yet, so just do some testing on a test site until you getting working the way you want with some test orders.

Robert

Thanks Robert for your quick response.I want your help to send sms notification that goes to customer's only.Can you help me ?

Thank you.
__________________
4.6.1 Platinum


Reply With Quote
  #6  
Old 08-26-2009, 09:10 AM
 
Tavarz Tavarz is offline
 

Advanced Member
  
Join Date: Nov 2008
Posts: 60
 

Default Re: How to add SMS notification

do you need some type of SMS gateway for this?
__________________
4.1.10
Reply With Quote
  #7  
Old 08-27-2009, 04:43 AM
 
Learner Learner is offline
 

X-Adept
  
Join Date: Dec 2008
Posts: 807
 

Default Re: How to add SMS notification

yes.
__________________
4.6.1 Platinum


Reply With Quote
  #8  
Old 08-29-2009, 01:28 PM
 
robertswww robertswww is offline
 

X-Adept
  
Join Date: Jul 2003
Posts: 586
 

Default Re: How to add SMS notification

Hello Learner,

To send an SMS Notification message to the customer, you will need to know the customer's SMS Email Address. Since there are numerous wireless companies, you would either need to collect that address from them, or their Cell Phone Number, and use a service or software product that can look-up that number and find the carrier and their SMS address domain. Optionally, use one of the SMS Gateway services to send a SMS to the customer's email address.

If you collect the SMS address during Checkout, just test and use the code that I supplied above. Otherwise, you will need to look into using a SMS Gateway service or piece of custom software, such as:

Kannel: Open Source WAP and SMS gateway:
http://www.kannel.org/

Upside Wireless: Developer APIs... Uses SOAP to send SMS messages directly from your web site...
http://www.upsidewireless.com/api.htm

VisualTron: VisualGSM Mobile Application Server... SQL database driven SMS Gateway / WAP Push Gateway:
http://www.visualtron.com/products.htm

View their online Demo to Send an SMS via Email using their email2sms plugin:
http://www.visualtron.com/online_demo2.htm

SMS Tutorial: What is an SMS Gateway?
http://www.developershome.com/sms/sms_tutorial.asp?page=smsGateway

Robert
__________________
X-cart 4.1.10
Reply With Quote
  #9  
Old 03-29-2012, 08:05 AM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default Re: How to add SMS notification

I'm trying to set this up in 4.3.2 and I'm not having any luck. Is there something that's different?

I've tried both SMS email addresses and other normal email address.

As far as the SMS gateway, you don't need one in order to email SMS email addresses. I do it all the time at work and we don't have one.
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #10  
Old 03-31-2012, 08:20 PM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default Re: How to add SMS notification

For those that are interested, I figured this out for 4.3.2

http://forum.x-cart.com/showthread.php?p=336406
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 09:58 AM.

   

 
X-Cart forums © 2001-2020