0

I have purchased my desired sms API and i have also written the code for that just need to invoke my code on checkout button how can you help me. Looking for a quick and easy solution Thanks

  • When do you want to trigger the sms? – Sivabupathy V R Sep 20 '16 at 6:44
  • when user click on checkout button to place order – Etuts Sep 20 '16 at 7:02
  • Create a ajax function on click of the function & in controller function you can write your action to do. – Sivabupathy V R Sep 20 '16 at 7:09
  • i am new in magento so can you please guide in which file i have to add.. – Etuts Sep 20 '16 at 7:10
  • easy solution is to purchase the readymade extension magecomp.com/magento-sms-notification.html – Gaurav Jain Apr 13 '17 at 14:13
0

In app/code/My/Module/etc/frontend/events.xml:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="checkout_onepage_controller_success_action">
    <observer name="mymodule_controller_success_action" instance="My\Module\Observer\MyObserver"  />
</event>

In app/code/My/Module/Observer/MyObserver.php

<?php
namespace My\Module\Observer;
use Magento\Framework\Event\ObserverInterface;
class MyObserver implements ObserverInterface
{
    public function execute(\Magento\Framework\Event\Observer $observer)
    {
       //Write your sms code here           $order = $observer->getEvent()->getOrder(); //Get order from event observer
        $order_id = $order->getID(); //Get order ID from order
        $order_number = $order->getIncrementId(); //Get order increment ID from order
        $customerId = $order->getCustomerId(); //Get customer ID from order
        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $customer = $objectManager->create('Magento\Customer\Model\Customer')->load($customerId);
        $name = $customer->getName(); //customer name
    }
}
?>
  • can you tell me how to get information like order id customer phone number etc... – Etuts Sep 20 '16 at 9:23
0

Isn't it safer to do what you have to do after success ordering or even after receiving payment?

I mean in success.phtml or with an observer when order status changes to i.e. Invoiced.

  • i want to sms on successful order placement – Etuts Oct 20 '16 at 8:10
0

Simply use this extension http://ext.topmage.com/Hacky_Smsnotifications.html to trigger SMS while place order, invoice, shipment etc. Its free and opensource and easy to customize (add new events for SMS).

You will only needed API details from SMS subscribing company.

0

I have create a module for telenor sms api. It will send an sms to the customer when place an order.
you can Download the module Here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.