-1

Magento sending SMS when order confirmed and creating shipment, we have PHP code below:

   <?php 
$ch = curl_init(); 
$user="**@bindaaslo.com:**"; 
$receipientno="98910***"; 
$senderID="TEST SMS"; 
$msgtxt="this is test message , test"; curl_setopt($ch,CURLOPT_URL, "http://api.mVaayoo.com/mvaayooapi/MessageCompose"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "user=$user&senderID=$senderID&receipientno=$receipientno&msgtxt=$msgtxt"); $buffer = curl_exec($ch); if(empty ($buffer)) { echo " buffer is empty "; } else { echo $buffer; } curl_close($ch); 
   ?>
Unheilig
  • 16,196
  • 193
  • 68
  • 98
  • This extension already has shipment notification for admin and customers both https://magecomp.com/magento-sms-notification.html – Gaurav Jain Apr 13 '17 at 11:16

1 Answers1

0

open file [magento]\app\code\core\Mage\Adminhtml\controllers\Sales\Order\ShipmentController.php

find saveAction() and add your code in that

public function saveAction()
    {
        ......................

        $ch = curl_init(); 
        $user="**@bindaaslo.com:**"; 
        $receipientno="98910***"; 
        $senderID="TEST SMS"; 
        $msgtxt="this is test message , test"; curl_setopt($ch,CURLOPT_URL, "http://api.mVaayoo.com/mvaayooapi/MessageCompose"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "user=$user&senderID=$senderID&receipientno=$receipientno&msgtxt=$msgtxt"); $buffer = curl_exec($ch); if(empty ($buffer)) { echo " buffer is empty "; } else { echo $buffer; } curl_close($ch); 

        ......................
    }

Note: Don't directly change in core files instead of it override controller.

Or

you can achieve same through observer

some links help you to create observer for sales_order_shipment_save_before events

Magento - 2 or more observer on same event

https://magento.stackexchange.com/questions/847/hook-into-order-shipped-event-and-get-order-id-for-order-shipped

Community
  • 1
  • 1
Shivam
  • 2,443
  • 17
  • 31