Post by alexist » Thu Jul 14, 2016 12:53 am

Hello, i've sms gateway code,

i want to add this code

Code: Select all

<!-----kode untuk kirim sms ke admin----->
 $nomor="085XXXXXXX";//isi no.hp admin atau anda sebagai pemilik toko.
 $email=$this->db->escape($data['email']);
 $pass= $this->db->escape($data['password']);
 $pesan="Ada Pendaftar baru, username: $email dan 
 password:".$pass." [prestashop.com]";
 $pesan=str_replace(" ","+",$pesan);
 $url="http://smsgatewa**.com/api?user=demo@gmail.com&pass=demo&pesan=". $pesan. " .
&senderid=modem1&nomor=".$nomor."";
   $curlHandle = curl_init();
   curl_setopt($curlHandle, CURLOPT_URL, $url);
   curl_setopt($curlHandle, CURLOPT_POSTFIELDS,"");
   curl_setopt($curlHandle, CURLOPT_HEADER, 0);
   curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt($curlHandle, CURLOPT_TIMEOUT,0);
   curl_setopt($curlHandle, CURLOPT_POST, 1);
   curl_exec($curlHandle);
   curl_close($curlHandle);
and

Code: Select all

<!------- kode untuk kirim sms ke pelanggan ------>        

   $nomor=$this->db->escape($data['telephone']);
   $pesan="Terimakasih telah mendaftar, username
anda:".$email." dan password:".$pass." [www.TokoOnlineku.com]";
   $pesan=str_replace(" ","+",$pesan);
   $url="http://smsgatewa**.com/api?user=demo@gmail.com&pass=demo&pesan=". $pesan. " .
&senderid=modem1&nomor=".$nomor."";
   $curlHandle = curl_init();
    curl_setopt($curlHandle, CURLOPT_URL, $url);
    curl_setopt($curlHandle, CURLOPT_POSTFIELDS,"");
    curl_setopt($curlHandle, CURLOPT_HEADER, 0);
    curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curlHandle, CURLOPT_TIMEOUT,0);
    curl_setopt($curlHandle, CURLOPT_POST, 1);
    curl_exec($curlHandle);
    curl_close($curlHandle); 
At my oc 1.5.5.1 this is work when i put this code on costumer.php : /public_html/catalog/model/account/customer.php
under this code line: public function addCustomer($data)
But on oc 2.2.0.0 this customer.php change dramatically and i always getting error when put this code.

if this code installed succesfully, my customer and i will recieve notification from sms gateway when they registered.
where should I install the code correctly?

thank

best regards
alex

User avatar
New member

Posts

Joined
Sun May 19, 2013 10:37 am

Post by straightlight » Thu Jul 14, 2016 11:18 pm

What is the error message you are receiving?

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by alexist » Sat Jul 16, 2016 2:33 am

Hi,
thanks for responding my post,
on this registration form i have succeded to put my smsgateway as same as on my oc 1.5.5.1 (like my 1st post) into my new oc 2.2.0.0. without any error.

But there is another problem when i put this code below on my catalog/model/checkout/order.php (**so when any member done checkout, will be get notice by smsgateway):

Code: Select all

/////////////////
$q="select * from oc_order where order_id='".$order_id."'";
			$dataOrder=mysql_fetch_array(mysql_query($q));
			$nomor="082134847015";
                        $pelanggan=$dataOrder['firstname'];
			$invoice=$order_id;
			$pesan="User ".$pelanggan." belanja dengan invoice:".$invoice.". Total belanja: Rp ".number_format($dataOrder['total'],0,',','.').",  [www.butikalyaonline.com]";
			$pesan=str_replace(" ","+",$pesan);
			$url="http://smsfortunata.com/api?user=demo@gmail.com&pass=demo&pesan=".$pesan."&senderid=modem1&nomor=".$nomor."";
			$curlHandle = curl_init();
			curl_setopt($curlHandle, CURLOPT_URL, $url);
			curl_setopt($curlHandle, CURLOPT_POSTFIELDS,"");
			curl_setopt($curlHandle, CURLOPT_HEADER, 0);
			curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, 1);
			curl_setopt($curlHandle, CURLOPT_TIMEOUT,0);
			curl_setopt($curlHandle, CURLOPT_POST, 1);
			curl_exec($curlHandle);
			curl_close($curlHandle); 
			
with 2 error:
1. on error log.

Code: Select all

2016-07-15 18:29:47 - PHP Warning:  mysql_query() [<a href='function.mysql-query'>function.mysql-query</a>]: Access denied for user 'root'@'localhost' (using password: NO) in /home/xxx/public_html/catalog/model/checkout/order.php on line 425
2016-07-15 18:29:47 - PHP Warning:  mysql_query() [<a href='function.mysql-query'>function.mysql-query</a>]: A link to the server could not be established in /home/xxx/public_html/catalog/model/checkout/order.php on line 425
2016-07-15 18:29:47 - PHP Warning:  mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/xxx/public_html/catalog/model/checkout/order.php on line 425
2. this variable $dataOrder is empty, should be appear the total order

i put between this section

Code: Select all

$data['store_name'] = $order_info['store_name'];
				$data['store_url'] = $order_info['store_url'];
				$data['customer_id'] = $order_info['customer_id'];
				$data['link'] = $order_info['store_url'] . 'index.php?route=account/order/info&order_id=' . $order_id;

////sms gateway code
code
///end code

if ($download_status) {
					$data['download'] = $order_info['store_url'] . 'index.php?route=account/download';
				} else {
					$data['download'] = '';
				}

thanks very much

best regards
alex

User avatar
New member

Posts

Joined
Sun May 19, 2013 10:37 am

Post by straightlight » Sat Jul 16, 2016 3:07 am

In both config.php and admin/config.php file, change mysql to: mysqli . This should resolved the database error messages, at least.

Also, to properly configure your DB settings on both same files:
A link to the server could not be established

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by alexist » Sat Jul 16, 2016 3:24 am

straightlight wrote:In both config.php and admin/config.php file, change mysql to: mysqli . This should resolved the database error messages, at least.

Also, to properly configure your DB settings on both same files:
A link to the server could not be established
hello,

my previous config.php already mysqli before this error shown

Code: Select all

// DB
define('DB_DRIVER', 'mysqli');
define('DB_HOSTNAME', 'localhost');
...

User avatar
New member

Posts

Joined
Sun May 19, 2013 10:37 am

Post by straightlight » Sat Jul 16, 2016 3:52 am

Then, somewhere in your code, it might be possible that original MySQL functions are being used aside of the Opencart Database object.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by alexist » Sat Jul 16, 2016 4:27 am

Hello,

and then what is the proper code , when i want to add my URL API SMS Gateway into order.php?

i just got this one from my sms gateway to sent sms

Code: Select all

$url="http://smsfortunata.com/api?user=demo@gmail.com&pass=demo&pesan="textsms"&senderid=modem1&nomor="phone number"";
thanks.

User avatar
New member

Posts

Joined
Sun May 19, 2013 10:37 am
Who is online

Users browsing this forum: No registered users and 3 guests