Opencart : Send SMS Notification to Customer after placing order?

Opencart allows us to create ,maintain,sell a catalog of products with ease and comfort,Almost 10 of the eCommerce websites are running Opencart to sell their products. Opencart is yet to develop in order to match the sociability,scalability and robustness of its competitors Woocommerce and Magento Customers like to receive SMS notification after placing an order form eCommerce websites along with email notification,As Email notifications is already coded by default in Opencart,SMS Notification has to be sent manually,In this post ,we will discuss how to send SMS Notification to customer after placing order in Opencart by the customer

Opencart : Send SMS Notification to Customer after placing order

Step 1 : SMS API is usually provided by the service provider,once the package is bought ,It usually looks like this more or less

http://example.com/[email protected]&pass=yourpassword&to=9876543210&msg=Message-to-be-sent&sid=SENDERID

Replace all given terms with the terms given by your SMS service provider.

Step 2: Then go to file manager using FTP or Cpanel of your hosting and then go to

/controller/checkout/success.php

First find

$this->cart->clear();

on line 5 and replace it with

		
$cnum = $this->customer->gettelephone(); // get customer mobile number
$getorderid = $this->session->data['order_id']; // get order id
$getordertotal = $this->cart->getTotal(); // get order total
$date = date("Y-m-d");
$this->cart->clear();
$this->load->model('account/customer');                 
$adminmsg ="A new order ".$getorderid." is placed on ".$date; // add msg sent to admin; 
$msisdn = "9876543210"; // admin number to be sent
$cumsg = "Your order (".$getorderid.")is placed,total amount is ".$getordertotal; // add msg sent to customer here 
$usr = "YOURLOGINID"; // use login id here
$pass = "YOURPASSWORD"; // use password here
$sid = "SENDERID";  // use sender id here
//send sms to admin also here
$aurl = "http://example.com/sendsms.php?usr=".$usr."&pass=".$pass."&to=".$msisdn."&msg=".$adminmsg."&sid=".$sid;
$ach = curl_init($aurl);
curl_setopt($ach, CURLOPT_RETURNTRANSFER, true);
$curl_scraped_page = curl_exec($ach);
curl_close($ach);
// end send sms to admin 
//send sms to customer here
$curl = "http://example.com/sendsms.php?usr=".$usr."&pass=".$pass."&to=".$cnum."&msg=".$cumsg."&sid=".$sid;
$cch = curl_init($curl);
curl_setopt($cch, CURLOPT_RETURNTRANSFER, true);
$curl_scraped_page = curl_exec($cch);
curl_close($cch);
// end send sms to customer here

save success.php and check the code whether the code is running or not? Post comments below if it not working . Here 2 sms notifications will be sent to admin and customer respectively,Notifying the order details Just change the parameters to your requirement and send sms happily with any 3rd party Opencart module.

customer,notification,opencart,order,sms