<event name="sales_order_save_after">
    <observer name="sales_order_save_after" instance="Magento\Sales\Observer\SalesOrderSaveAfter" />


 namespace Magento\Sales\Observer;

use Magento\Framework\App\State;
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Sales\Api\Data\OrderPaymentInterface;
use Magento\Sales\Model\ResourceModel\Order\Payment\Collection;
use Psr\Log\LoggerInterface as PsrLogger;

    class SalesOrderSaveAfter implements ObserverInterface
        * @var $_logger
        private $_logger;

        * @var \Magento\Framework\HTTP\Client\Curl
        protected $_curl;

     * ConvertAdditionalInfoObserver constructor.
     * @param State $state
     * @param \Magento\Framework\HTTP\Client\Curl $curl
    public function __construct(
        PsrLogger $logger,
        State $state,
        \Magento\Framework\HTTP\Client\Curl $curl
        $this->state = $state;
        $this->_curl = $curl;
        $this->_logger = $logger;

    public function execute(\Magento\Framework\Event\Observer $observer)
        $ObserverInterface = $observer->getEvent()->getOrder(); //Get customer object

           echo $ObserverInterface->getId()."<br>";
        echo "OldStatus: ".$OldStatus."<br>";
        echo "NewStatus: ".$NewStatus."<br>";



enter image description here

I am trying to get order status in sales_order_save_after observer, In the output am getting the result but it showing an interceptor error. what it means? how can i solve this issue??. Thanks in advance for your valuabe answers.

  • just remove var and generated folder from root Commented Jan 19, 2018 at 5:19
  • Refer this link.
    – Pratik Oza
    Commented Jan 19, 2018 at 5:28
  • i removed var/generation folder and compiled again. but it get the same error
    – Midlaj
    Commented Jan 19, 2018 at 5:28
  • show your full code of observer file. Commented Jan 19, 2018 at 5:35
  • i have given full observer code please check it
    – Midlaj
    Commented Jan 19, 2018 at 5:58


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.