Error when observer is executed after order is placedSetup version for module 'Sample_CustomController' is not specifiedI created a custom module ,but getting error, not able to figure out what the error is about. How to get out of this error?Invalid template file: 'Magehit_Bestsellerproducts::html/bestsellerblock.phtml'Magento 2.3 Inject helper into controller object type error?Magento 2 module error after version upgradeDeleted ShipperHQ module causing error in “All Customers” section of Magento 2Magento 2.3.0 - The store that was requested wasn't foundMagento2.3 : Layered Navigation issueMagento 2.3.1 Error on checkout getAdditionalInformation()MsrpPriceCalculator Exception

How can I stop myself from micromanaging other PCs' actions?

How do I address my Catering staff subordinate seen eating from a chafing dish before the customers?

Character is called by their first initial. How do I write it?

This message is flooding my syslog, how to find where it comes from?

Invert Some Switches on a Switchboard

Wallet management now that accounts are deprecated?

Keeping an "hot eyeball planet" wet

Why was Sauron preparing for war instead of trying to find the ring?

Trying to build a function to compute divided difference for arbitrary list of points

Why can't my huge trees be chopped down?

Expansion with *.txt in the shell doesn't work if no .txt file exists

Is my employer paying me fairly? Going from 1099 to W2

Area of parallelogram = Area of square. Shear transform

What do teaching faculty do during semester breaks?

How to avoid unconsciously copying the style of my favorite writer?

What self-defense weapons are legal in London?

Spoken encryption

3D Statue Park: U shapes

Singapore to Sydney to Canberra: where do we clear customs

USA: Can a witness take the 5th to avoid perjury?

Why is drive/partition number still used?

kids pooling money for Lego League and taxes

Why are so many countries still in the Commonwealth?

How to judge a Ph.D. applicant that arrives "out of thin air"



Error when observer is executed after order is placed


Setup version for module 'Sample_CustomController' is not specifiedI created a custom module ,but getting error, not able to figure out what the error is about. How to get out of this error?Invalid template file: 'Magehit_Bestsellerproducts::html/bestsellerblock.phtml'Magento 2.3 Inject helper into controller object type error?Magento 2 module error after version upgradeDeleted ShipperHQ module causing error in “All Customers” section of Magento 2Magento 2.3.0 - The store that was requested wasn't foundMagento2.3 : Layered Navigation issueMagento 2.3.1 Error on checkout getAdditionalInformation()MsrpPriceCalculator Exception






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I created a module in order to save order data to a custom table:



<?xml version="1.0"?>
<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="order_place_navision" instance="MyVendorSalesOrderSyncObserverSaveOrder"/>
</event>
</config>


Observer/SaveOrder.php:



<?php

namespace MyVendorSalesOrderSyncObserver;

use MagentoFrameworkEventObserverInterface;
use MagentoFrameworkAppBootstrap;

class SaveOrder implements ObserverInterface

private $logger;
private $state;

public function __construct(
MagentoFrameworkViewElementContext $context,
PsrLogLoggerInterface $logger,
MagentoFrameworkAppState $state
)
$this->_layout = $context->getLayout();
$this->_request = $context->getRequest();
$this->logger = $logger;
$this->_state = $state;

try
$this->_state->setAreaCode(MagentoFrameworkAppArea::AREA_ADMINHTML);
catch (MagentoFrameworkExceptionLocalizedException $e)
// nothing to do




public function execute(MagentoFrameworkEventObserver $observer)


$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');
$objDate = $objectManager->create('MagentoFrameworkStdlibDateTimeDateTime');
$date = $objDate->gmtDate();

$resource = $objectManager->get('MagentoFrameworkAppResourceConnection');
$connection = $resource->getConnection();
$orderId = $observer->getEvent()->getOrderIds()[0];

$sql = "INSERT INTO custom_sap_orders (entity_id, order_id, sent, timestamp) Values (''," .
$orderId .
", '" .
"0" .
"', '" .
$date .
"')" ;
$connection->query($sql);





But I get this error when I complete an order:



1 exception(s):
Exception #0 (MagentoFrameworkExceptionRuntimeException): Type Error occurred when creating object: MagentoCaptchaModelCheckoutConfigProvider

Exception #0 (MagentoFrameworkExceptionRuntimeException): Type Error occurred when creating object: MagentoCaptchaModelCheckoutConfigProvider
<pre>#1 MagentoFrameworkObjectManagerFactoryCompiled->create('MagentoCaptcha...') called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:150]
#2 MagentoFrameworkObjectManagerFactoryCompiled->get('MagentoCaptcha...') called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:79]
#3 MagentoFrameworkObjectManagerFactoryCompiled->create('MagentoCaptcha...') called at [vendor/magento/framework/ObjectManager/ObjectManager.php:70]
#4 MagentoFrameworkObjectManagerObjectManager->get('MagentoCaptcha...') called at [vendor/magento/framework/Interception/PluginList/PluginList.php:250]
#5 MagentoFrameworkInterceptionPluginListPluginList->getPlugin('MagentoCheckout...', 'login_captcha') called at [vendor/magento/framework/Interception/Interceptor.php:144]
#6 MagentoCheckoutBlockCartSidebarInterceptor->MagentoFrameworkInterceptionclosure() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#7 MagentoCheckoutBlockCartSidebarInterceptor->___callPlugins('getConfig', array(), array(array('customer_cart', 'login_captcha'))) called at [generated/code/Magento/Checkout/Block/Cart/Sidebar/Interceptor.php:26]
#8 MagentoCheckoutBlockCartSidebarInterceptor->getConfig() called at [app/design/frontend/Smartwave/porto/Magento_Checkout/templates/cart/minicart.phtml:45]
#9 include('/var/www/html/ap...') called at [vendor/magento/framework/View/TemplateEngine/Php.php:59]
#10 MagentoFrameworkViewTemplateEnginePhp->render(&MagentoCheckoutBlockCartSidebarInterceptor#0000000012d1f258000000005dbf9a65#, '/var/www/html/ap...', array()) called at [vendor/magento/framework/View/Element/Template.php:271]
#11 MagentoFrameworkViewElementTemplate->fetchView('/var/www/html/ap...') called at [vendor/magento/framework/View/Element/Template.php:301]
#12 MagentoFrameworkViewElementTemplate->_toHtml() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1094]
#13 MagentoFrameworkViewElementAbstractBlock->MagentoFrameworkViewElementclosure() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1098]
#14 MagentoFrameworkViewElementAbstractBlock->_loadCache() called at [vendor/magento/framework/View/Element/AbstractBlock.php:671]
#15 MagentoFrameworkViewElementAbstractBlock->toHtml() called at [vendor/magento/framework/View/Layout.php:557]
#16 MagentoFrameworkViewLayout->_renderBlock('minicart') called at [vendor/magento/framework/View/Layout.php:533]
#17 MagentoFrameworkViewLayout->renderNonCachedElement('minicart') called at [vendor/magento/framework/View/Layout.php:488]
#18 MagentoFrameworkViewLayout->renderElement('minicart', true) called at [vendor/magento/framework/View/Element/AbstractBlock.php:518]
#19 MagentoFrameworkViewElementAbstractBlock->getChildHtml('minicart')
#20 call_user_func_array(array(&SmartwavePortoBlockTemplate#0000000012d1f267000000005dbf9a65#, 'getChildHtml'), array('minicart')) called at [vendor/magento/framework/View/TemplateEngine/Php.php:82]
#21 MagentoFrameworkViewTemplateEnginePhp->__call('getChildHtml', array('minicart')) called at [app/design/frontend/Smartwave/porto/Smartwave_Porto/templates/html/header.phtml:269]
#22 include('/var/www/html/ap...') called at [vendor/magento/framework/View/TemplateEngine/Php.php:59]
#23 MagentoFrameworkViewTemplateEnginePhp->render(&SmartwavePortoBlockTemplate#0000000012d1f267000000005dbf9a65#, '/var/www/html/ap...', array()) called at [vendor/magento/framework/View/Element/Template.php:271]
#24 MagentoFrameworkViewElementTemplate->fetchView('/var/www/html/ap...') called at [vendor/magento/framework/View/Element/Template.php:301]
#25 MagentoFrameworkViewElementTemplate->_toHtml() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1094]
#26 MagentoFrameworkViewElementAbstractBlock->MagentoFrameworkViewElementclosure() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1098]
#27 MagentoFrameworkViewElementAbstractBlock->_loadCache() called at [vendor/magento/framework/View/Element/AbstractBlock.php:671]
#28 MagentoFrameworkViewElementAbstractBlock->toHtml() called at [vendor/magento/framework/View/Layout.php:557]
#29 MagentoFrameworkViewLayout->_renderBlock('porto_header') called at [vendor/magento/framework/View/Layout.php:533]
#30 MagentoFrameworkViewLayout->renderNonCachedElement('porto_header') called at [vendor/magento/framework/View/Layout.php:488]
#31 MagentoFrameworkViewLayout->renderElement('porto_header', false) called at [vendor/magento/framework/View/Layout.php:585]
#32 MagentoFrameworkViewLayout->_renderContainer('page.wrapper', false) called at [vendor/magento/framework/View/Layout.php:535]
#33 MagentoFrameworkViewLayout->renderNonCachedElement('page.wrapper') called at [vendor/magento/framework/View/Layout.php:488]
#34 MagentoFrameworkViewLayout->renderElement('page.wrapper', false) called at [vendor/magento/framework/View/Layout.php:585]
#35 MagentoFrameworkViewLayout->_renderContainer('root', false) called at [vendor/magento/framework/View/Layout.php:535]
#36 MagentoFrameworkViewLayout->renderNonCachedElement('root') called at [vendor/magento/framework/View/Layout.php:488]
#37 MagentoFrameworkViewLayout->renderElement('root') called at [vendor/magento/framework/View/Layout.php:954]
#38 MagentoFrameworkViewLayout->getOutput() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#39 MagentoFrameworkViewLayoutInterceptor->___callParent('getOutput', array()) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#40 MagentoFrameworkViewLayoutInterceptor->MagentoFrameworkInterceptionclosure() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#41 MagentoFrameworkViewLayoutInterceptor->___callPlugins('getOutput', array(), array(array('layout-model-cac...'))) called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:39]
#42 MagentoFrameworkViewLayoutInterceptor->getOutput() called at [vendor/magento/framework/View/Result/Page.php:258]
#43 MagentoFrameworkViewResultPage->render(&MagentoFrameworkAppResponseHttpInterceptor#0000000012d1f40e000000005dbf9a65#) called at [vendor/magento/framework/View/Result/Layout.php:171]
#44 MagentoFrameworkViewResultLayout->renderResult(&MagentoFrameworkAppResponseHttpInterceptor#0000000012d1f40e000000005dbf9a65#) called at [vendor/magento/framework/Interception/Interceptor.php:58]
#45 MagentoFrameworkViewResultPageInterceptor->___callParent('renderResult', array(&MagentoFrameworkAppResponseHttpInterceptor#0000000012d1f40e000000005dbf9a65#)) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#46 MagentoFrameworkViewResultPageInterceptor->MagentoFrameworkInterceptionclosure(&MagentoFrameworkAppResponseHttpInterceptor#0000000012d1f40e000000005dbf9a65#) called at [vendor/magento/framework/Interception/Interceptor.php:153]
#47 MagentoFrameworkViewResultPageInterceptor->___callPlugins('renderResult', array(&MagentoFrameworkAppResponseHttpInterceptor#0000000012d1f40e000000005dbf9a65#), array(array('result-messages', 'result-builtin-c...', 'result-varnish-c...'))) called at [generated/code/Magento/Framework/View/Result/Page/Interceptor.php:39]
#48 MagentoFrameworkViewResultPageInterceptor->renderResult(&MagentoFrameworkAppResponseHttpInterceptor#0000000012d1f40e000000005dbf9a65#) called at [vendor/magento/framework/App/Http.php:141]
#49 MagentoFrameworkAppHttp->launch() called at [vendor/magento/framework/App/Bootstrap.php:261]
#50 MagentoFrameworkAppBootstrap->run(&MagentoFrameworkAppHttpInterceptor#0000000012d1f408000000005dbf9a65#) called at [index.php:39]
</pre>


Any idea in order to solve it?










share|improve this question






























    0















    I created a module in order to save order data to a custom table:



    <?xml version="1.0"?>
    <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="order_place_navision" instance="MyVendorSalesOrderSyncObserverSaveOrder"/>
    </event>
    </config>


    Observer/SaveOrder.php:



    <?php

    namespace MyVendorSalesOrderSyncObserver;

    use MagentoFrameworkEventObserverInterface;
    use MagentoFrameworkAppBootstrap;

    class SaveOrder implements ObserverInterface

    private $logger;
    private $state;

    public function __construct(
    MagentoFrameworkViewElementContext $context,
    PsrLogLoggerInterface $logger,
    MagentoFrameworkAppState $state
    )
    $this->_layout = $context->getLayout();
    $this->_request = $context->getRequest();
    $this->logger = $logger;
    $this->_state = $state;

    try
    $this->_state->setAreaCode(MagentoFrameworkAppArea::AREA_ADMINHTML);
    catch (MagentoFrameworkExceptionLocalizedException $e)
    // nothing to do




    public function execute(MagentoFrameworkEventObserver $observer)


    $bootstrap = Bootstrap::create(BP, $_SERVER);
    $objectManager = $bootstrap->getObjectManager();
    $state = $objectManager->get('MagentoFrameworkAppState');
    $state->setAreaCode('frontend');
    $objDate = $objectManager->create('MagentoFrameworkStdlibDateTimeDateTime');
    $date = $objDate->gmtDate();

    $resource = $objectManager->get('MagentoFrameworkAppResourceConnection');
    $connection = $resource->getConnection();
    $orderId = $observer->getEvent()->getOrderIds()[0];

    $sql = "INSERT INTO custom_sap_orders (entity_id, order_id, sent, timestamp) Values (''," .
    $orderId .
    ", '" .
    "0" .
    "', '" .
    $date .
    "')" ;
    $connection->query($sql);





    But I get this error when I complete an order:



    1 exception(s):
    Exception #0 (MagentoFrameworkExceptionRuntimeException): Type Error occurred when creating object: MagentoCaptchaModelCheckoutConfigProvider

    Exception #0 (MagentoFrameworkExceptionRuntimeException): Type Error occurred when creating object: MagentoCaptchaModelCheckoutConfigProvider
    <pre>#1 MagentoFrameworkObjectManagerFactoryCompiled->create('MagentoCaptcha...') called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:150]
    #2 MagentoFrameworkObjectManagerFactoryCompiled->get('MagentoCaptcha...') called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:79]
    #3 MagentoFrameworkObjectManagerFactoryCompiled->create('MagentoCaptcha...') called at [vendor/magento/framework/ObjectManager/ObjectManager.php:70]
    #4 MagentoFrameworkObjectManagerObjectManager->get('MagentoCaptcha...') called at [vendor/magento/framework/Interception/PluginList/PluginList.php:250]
    #5 MagentoFrameworkInterceptionPluginListPluginList->getPlugin('MagentoCheckout...', 'login_captcha') called at [vendor/magento/framework/Interception/Interceptor.php:144]
    #6 MagentoCheckoutBlockCartSidebarInterceptor->MagentoFrameworkInterceptionclosure() called at [vendor/magento/framework/Interception/Interceptor.php:153]
    #7 MagentoCheckoutBlockCartSidebarInterceptor->___callPlugins('getConfig', array(), array(array('customer_cart', 'login_captcha'))) called at [generated/code/Magento/Checkout/Block/Cart/Sidebar/Interceptor.php:26]
    #8 MagentoCheckoutBlockCartSidebarInterceptor->getConfig() called at [app/design/frontend/Smartwave/porto/Magento_Checkout/templates/cart/minicart.phtml:45]
    #9 include('/var/www/html/ap...') called at [vendor/magento/framework/View/TemplateEngine/Php.php:59]
    #10 MagentoFrameworkViewTemplateEnginePhp->render(&MagentoCheckoutBlockCartSidebarInterceptor#0000000012d1f258000000005dbf9a65#, '/var/www/html/ap...', array()) called at [vendor/magento/framework/View/Element/Template.php:271]
    #11 MagentoFrameworkViewElementTemplate->fetchView('/var/www/html/ap...') called at [vendor/magento/framework/View/Element/Template.php:301]
    #12 MagentoFrameworkViewElementTemplate->_toHtml() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1094]
    #13 MagentoFrameworkViewElementAbstractBlock->MagentoFrameworkViewElementclosure() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1098]
    #14 MagentoFrameworkViewElementAbstractBlock->_loadCache() called at [vendor/magento/framework/View/Element/AbstractBlock.php:671]
    #15 MagentoFrameworkViewElementAbstractBlock->toHtml() called at [vendor/magento/framework/View/Layout.php:557]
    #16 MagentoFrameworkViewLayout->_renderBlock('minicart') called at [vendor/magento/framework/View/Layout.php:533]
    #17 MagentoFrameworkViewLayout->renderNonCachedElement('minicart') called at [vendor/magento/framework/View/Layout.php:488]
    #18 MagentoFrameworkViewLayout->renderElement('minicart', true) called at [vendor/magento/framework/View/Element/AbstractBlock.php:518]
    #19 MagentoFrameworkViewElementAbstractBlock->getChildHtml('minicart')
    #20 call_user_func_array(array(&SmartwavePortoBlockTemplate#0000000012d1f267000000005dbf9a65#, 'getChildHtml'), array('minicart')) called at [vendor/magento/framework/View/TemplateEngine/Php.php:82]
    #21 MagentoFrameworkViewTemplateEnginePhp->__call('getChildHtml', array('minicart')) called at [app/design/frontend/Smartwave/porto/Smartwave_Porto/templates/html/header.phtml:269]
    #22 include('/var/www/html/ap...') called at [vendor/magento/framework/View/TemplateEngine/Php.php:59]
    #23 MagentoFrameworkViewTemplateEnginePhp->render(&SmartwavePortoBlockTemplate#0000000012d1f267000000005dbf9a65#, '/var/www/html/ap...', array()) called at [vendor/magento/framework/View/Element/Template.php:271]
    #24 MagentoFrameworkViewElementTemplate->fetchView('/var/www/html/ap...') called at [vendor/magento/framework/View/Element/Template.php:301]
    #25 MagentoFrameworkViewElementTemplate->_toHtml() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1094]
    #26 MagentoFrameworkViewElementAbstractBlock->MagentoFrameworkViewElementclosure() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1098]
    #27 MagentoFrameworkViewElementAbstractBlock->_loadCache() called at [vendor/magento/framework/View/Element/AbstractBlock.php:671]
    #28 MagentoFrameworkViewElementAbstractBlock->toHtml() called at [vendor/magento/framework/View/Layout.php:557]
    #29 MagentoFrameworkViewLayout->_renderBlock('porto_header') called at [vendor/magento/framework/View/Layout.php:533]
    #30 MagentoFrameworkViewLayout->renderNonCachedElement('porto_header') called at [vendor/magento/framework/View/Layout.php:488]
    #31 MagentoFrameworkViewLayout->renderElement('porto_header', false) called at [vendor/magento/framework/View/Layout.php:585]
    #32 MagentoFrameworkViewLayout->_renderContainer('page.wrapper', false) called at [vendor/magento/framework/View/Layout.php:535]
    #33 MagentoFrameworkViewLayout->renderNonCachedElement('page.wrapper') called at [vendor/magento/framework/View/Layout.php:488]
    #34 MagentoFrameworkViewLayout->renderElement('page.wrapper', false) called at [vendor/magento/framework/View/Layout.php:585]
    #35 MagentoFrameworkViewLayout->_renderContainer('root', false) called at [vendor/magento/framework/View/Layout.php:535]
    #36 MagentoFrameworkViewLayout->renderNonCachedElement('root') called at [vendor/magento/framework/View/Layout.php:488]
    #37 MagentoFrameworkViewLayout->renderElement('root') called at [vendor/magento/framework/View/Layout.php:954]
    #38 MagentoFrameworkViewLayout->getOutput() called at [vendor/magento/framework/Interception/Interceptor.php:58]
    #39 MagentoFrameworkViewLayoutInterceptor->___callParent('getOutput', array()) called at [vendor/magento/framework/Interception/Interceptor.php:138]
    #40 MagentoFrameworkViewLayoutInterceptor->MagentoFrameworkInterceptionclosure() called at [vendor/magento/framework/Interception/Interceptor.php:153]
    #41 MagentoFrameworkViewLayoutInterceptor->___callPlugins('getOutput', array(), array(array('layout-model-cac...'))) called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:39]
    #42 MagentoFrameworkViewLayoutInterceptor->getOutput() called at [vendor/magento/framework/View/Result/Page.php:258]
    #43 MagentoFrameworkViewResultPage->render(&MagentoFrameworkAppResponseHttpInterceptor#0000000012d1f40e000000005dbf9a65#) called at [vendor/magento/framework/View/Result/Layout.php:171]
    #44 MagentoFrameworkViewResultLayout->renderResult(&MagentoFrameworkAppResponseHttpInterceptor#0000000012d1f40e000000005dbf9a65#) called at [vendor/magento/framework/Interception/Interceptor.php:58]
    #45 MagentoFrameworkViewResultPageInterceptor->___callParent('renderResult', array(&MagentoFrameworkAppResponseHttpInterceptor#0000000012d1f40e000000005dbf9a65#)) called at [vendor/magento/framework/Interception/Interceptor.php:138]
    #46 MagentoFrameworkViewResultPageInterceptor->MagentoFrameworkInterceptionclosure(&MagentoFrameworkAppResponseHttpInterceptor#0000000012d1f40e000000005dbf9a65#) called at [vendor/magento/framework/Interception/Interceptor.php:153]
    #47 MagentoFrameworkViewResultPageInterceptor->___callPlugins('renderResult', array(&MagentoFrameworkAppResponseHttpInterceptor#0000000012d1f40e000000005dbf9a65#), array(array('result-messages', 'result-builtin-c...', 'result-varnish-c...'))) called at [generated/code/Magento/Framework/View/Result/Page/Interceptor.php:39]
    #48 MagentoFrameworkViewResultPageInterceptor->renderResult(&MagentoFrameworkAppResponseHttpInterceptor#0000000012d1f40e000000005dbf9a65#) called at [vendor/magento/framework/App/Http.php:141]
    #49 MagentoFrameworkAppHttp->launch() called at [vendor/magento/framework/App/Bootstrap.php:261]
    #50 MagentoFrameworkAppBootstrap->run(&MagentoFrameworkAppHttpInterceptor#0000000012d1f408000000005dbf9a65#) called at [index.php:39]
    </pre>


    Any idea in order to solve it?










    share|improve this question


























      0












      0








      0








      I created a module in order to save order data to a custom table:



      <?xml version="1.0"?>
      <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="order_place_navision" instance="MyVendorSalesOrderSyncObserverSaveOrder"/>
      </event>
      </config>


      Observer/SaveOrder.php:



      <?php

      namespace MyVendorSalesOrderSyncObserver;

      use MagentoFrameworkEventObserverInterface;
      use MagentoFrameworkAppBootstrap;

      class SaveOrder implements ObserverInterface

      private $logger;
      private $state;

      public function __construct(
      MagentoFrameworkViewElementContext $context,
      PsrLogLoggerInterface $logger,
      MagentoFrameworkAppState $state
      )
      $this->_layout = $context->getLayout();
      $this->_request = $context->getRequest();
      $this->logger = $logger;
      $this->_state = $state;

      try
      $this->_state->setAreaCode(MagentoFrameworkAppArea::AREA_ADMINHTML);
      catch (MagentoFrameworkExceptionLocalizedException $e)
      // nothing to do




      public function execute(MagentoFrameworkEventObserver $observer)


      $bootstrap = Bootstrap::create(BP, $_SERVER);
      $objectManager = $bootstrap->getObjectManager();
      $state = $objectManager->get('MagentoFrameworkAppState');
      $state->setAreaCode('frontend');
      $objDate = $objectManager->create('MagentoFrameworkStdlibDateTimeDateTime');
      $date = $objDate->gmtDate();

      $resource = $objectManager->get('MagentoFrameworkAppResourceConnection');
      $connection = $resource->getConnection();
      $orderId = $observer->getEvent()->getOrderIds()[0];

      $sql = "INSERT INTO custom_sap_orders (entity_id, order_id, sent, timestamp) Values (''," .
      $orderId .
      ", '" .
      "0" .
      "', '" .
      $date .
      "')" ;
      $connection->query($sql);





      But I get this error when I complete an order:



      1 exception(s):
      Exception #0 (MagentoFrameworkExceptionRuntimeException): Type Error occurred when creating object: MagentoCaptchaModelCheckoutConfigProvider

      Exception #0 (MagentoFrameworkExceptionRuntimeException): Type Error occurred when creating object: MagentoCaptchaModelCheckoutConfigProvider
      <pre>#1 MagentoFrameworkObjectManagerFactoryCompiled->create('MagentoCaptcha...') called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:150]
      #2 MagentoFrameworkObjectManagerFactoryCompiled->get('MagentoCaptcha...') called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:79]
      #3 MagentoFrameworkObjectManagerFactoryCompiled->create('MagentoCaptcha...') called at [vendor/magento/framework/ObjectManager/ObjectManager.php:70]
      #4 MagentoFrameworkObjectManagerObjectManager->get('MagentoCaptcha...') called at [vendor/magento/framework/Interception/PluginList/PluginList.php:250]
      #5 MagentoFrameworkInterceptionPluginListPluginList->getPlugin('MagentoCheckout...', 'login_captcha') called at [vendor/magento/framework/Interception/Interceptor.php:144]
      #6 MagentoCheckoutBlockCartSidebarInterceptor->MagentoFrameworkInterceptionclosure() called at [vendor/magento/framework/Interception/Interceptor.php:153]
      #7 MagentoCheckoutBlockCartSidebarInterceptor->___callPlugins('getConfig', array(), array(array('customer_cart', 'login_captcha'))) called at [generated/code/Magento/Checkout/Block/Cart/Sidebar/Interceptor.php:26]
      #8 MagentoCheckoutBlockCartSidebarInterceptor->getConfig() called at [app/design/frontend/Smartwave/porto/Magento_Checkout/templates/cart/minicart.phtml:45]
      #9 include('/var/www/html/ap...') called at [vendor/magento/framework/View/TemplateEngine/Php.php:59]
      #10 MagentoFrameworkViewTemplateEnginePhp->render(&MagentoCheckoutBlockCartSidebarInterceptor#0000000012d1f258000000005dbf9a65#, '/var/www/html/ap...', array()) called at [vendor/magento/framework/View/Element/Template.php:271]
      #11 MagentoFrameworkViewElementTemplate->fetchView('/var/www/html/ap...') called at [vendor/magento/framework/View/Element/Template.php:301]
      #12 MagentoFrameworkViewElementTemplate->_toHtml() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1094]
      #13 MagentoFrameworkViewElementAbstractBlock->MagentoFrameworkViewElementclosure() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1098]
      #14 MagentoFrameworkViewElementAbstractBlock->_loadCache() called at [vendor/magento/framework/View/Element/AbstractBlock.php:671]
      #15 MagentoFrameworkViewElementAbstractBlock->toHtml() called at [vendor/magento/framework/View/Layout.php:557]
      #16 MagentoFrameworkViewLayout->_renderBlock('minicart') called at [vendor/magento/framework/View/Layout.php:533]
      #17 MagentoFrameworkViewLayout->renderNonCachedElement('minicart') called at [vendor/magento/framework/View/Layout.php:488]
      #18 MagentoFrameworkViewLayout->renderElement('minicart', true) called at [vendor/magento/framework/View/Element/AbstractBlock.php:518]
      #19 MagentoFrameworkViewElementAbstractBlock->getChildHtml('minicart')
      #20 call_user_func_array(array(&SmartwavePortoBlockTemplate#0000000012d1f267000000005dbf9a65#, 'getChildHtml'), array('minicart')) called at [vendor/magento/framework/View/TemplateEngine/Php.php:82]
      #21 MagentoFrameworkViewTemplateEnginePhp->__call('getChildHtml', array('minicart')) called at [app/design/frontend/Smartwave/porto/Smartwave_Porto/templates/html/header.phtml:269]
      #22 include('/var/www/html/ap...') called at [vendor/magento/framework/View/TemplateEngine/Php.php:59]
      #23 MagentoFrameworkViewTemplateEnginePhp->render(&SmartwavePortoBlockTemplate#0000000012d1f267000000005dbf9a65#, '/var/www/html/ap...', array()) called at [vendor/magento/framework/View/Element/Template.php:271]
      #24 MagentoFrameworkViewElementTemplate->fetchView('/var/www/html/ap...') called at [vendor/magento/framework/View/Element/Template.php:301]
      #25 MagentoFrameworkViewElementTemplate->_toHtml() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1094]
      #26 MagentoFrameworkViewElementAbstractBlock->MagentoFrameworkViewElementclosure() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1098]
      #27 MagentoFrameworkViewElementAbstractBlock->_loadCache() called at [vendor/magento/framework/View/Element/AbstractBlock.php:671]
      #28 MagentoFrameworkViewElementAbstractBlock->toHtml() called at [vendor/magento/framework/View/Layout.php:557]
      #29 MagentoFrameworkViewLayout->_renderBlock('porto_header') called at [vendor/magento/framework/View/Layout.php:533]
      #30 MagentoFrameworkViewLayout->renderNonCachedElement('porto_header') called at [vendor/magento/framework/View/Layout.php:488]
      #31 MagentoFrameworkViewLayout->renderElement('porto_header', false) called at [vendor/magento/framework/View/Layout.php:585]
      #32 MagentoFrameworkViewLayout->_renderContainer('page.wrapper', false) called at [vendor/magento/framework/View/Layout.php:535]
      #33 MagentoFrameworkViewLayout->renderNonCachedElement('page.wrapper') called at [vendor/magento/framework/View/Layout.php:488]
      #34 MagentoFrameworkViewLayout->renderElement('page.wrapper', false) called at [vendor/magento/framework/View/Layout.php:585]
      #35 MagentoFrameworkViewLayout->_renderContainer('root', false) called at [vendor/magento/framework/View/Layout.php:535]
      #36 MagentoFrameworkViewLayout->renderNonCachedElement('root') called at [vendor/magento/framework/View/Layout.php:488]
      #37 MagentoFrameworkViewLayout->renderElement('root') called at [vendor/magento/framework/View/Layout.php:954]
      #38 MagentoFrameworkViewLayout->getOutput() called at [vendor/magento/framework/Interception/Interceptor.php:58]
      #39 MagentoFrameworkViewLayoutInterceptor->___callParent('getOutput', array()) called at [vendor/magento/framework/Interception/Interceptor.php:138]
      #40 MagentoFrameworkViewLayoutInterceptor->MagentoFrameworkInterceptionclosure() called at [vendor/magento/framework/Interception/Interceptor.php:153]
      #41 MagentoFrameworkViewLayoutInterceptor->___callPlugins('getOutput', array(), array(array('layout-model-cac...'))) called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:39]
      #42 MagentoFrameworkViewLayoutInterceptor->getOutput() called at [vendor/magento/framework/View/Result/Page.php:258]
      #43 MagentoFrameworkViewResultPage->render(&MagentoFrameworkAppResponseHttpInterceptor#0000000012d1f40e000000005dbf9a65#) called at [vendor/magento/framework/View/Result/Layout.php:171]
      #44 MagentoFrameworkViewResultLayout->renderResult(&MagentoFrameworkAppResponseHttpInterceptor#0000000012d1f40e000000005dbf9a65#) called at [vendor/magento/framework/Interception/Interceptor.php:58]
      #45 MagentoFrameworkViewResultPageInterceptor->___callParent('renderResult', array(&MagentoFrameworkAppResponseHttpInterceptor#0000000012d1f40e000000005dbf9a65#)) called at [vendor/magento/framework/Interception/Interceptor.php:138]
      #46 MagentoFrameworkViewResultPageInterceptor->MagentoFrameworkInterceptionclosure(&MagentoFrameworkAppResponseHttpInterceptor#0000000012d1f40e000000005dbf9a65#) called at [vendor/magento/framework/Interception/Interceptor.php:153]
      #47 MagentoFrameworkViewResultPageInterceptor->___callPlugins('renderResult', array(&MagentoFrameworkAppResponseHttpInterceptor#0000000012d1f40e000000005dbf9a65#), array(array('result-messages', 'result-builtin-c...', 'result-varnish-c...'))) called at [generated/code/Magento/Framework/View/Result/Page/Interceptor.php:39]
      #48 MagentoFrameworkViewResultPageInterceptor->renderResult(&MagentoFrameworkAppResponseHttpInterceptor#0000000012d1f40e000000005dbf9a65#) called at [vendor/magento/framework/App/Http.php:141]
      #49 MagentoFrameworkAppHttp->launch() called at [vendor/magento/framework/App/Bootstrap.php:261]
      #50 MagentoFrameworkAppBootstrap->run(&MagentoFrameworkAppHttpInterceptor#0000000012d1f408000000005dbf9a65#) called at [index.php:39]
      </pre>


      Any idea in order to solve it?










      share|improve this question
















      I created a module in order to save order data to a custom table:



      <?xml version="1.0"?>
      <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="order_place_navision" instance="MyVendorSalesOrderSyncObserverSaveOrder"/>
      </event>
      </config>


      Observer/SaveOrder.php:



      <?php

      namespace MyVendorSalesOrderSyncObserver;

      use MagentoFrameworkEventObserverInterface;
      use MagentoFrameworkAppBootstrap;

      class SaveOrder implements ObserverInterface

      private $logger;
      private $state;

      public function __construct(
      MagentoFrameworkViewElementContext $context,
      PsrLogLoggerInterface $logger,
      MagentoFrameworkAppState $state
      )
      $this->_layout = $context->getLayout();
      $this->_request = $context->getRequest();
      $this->logger = $logger;
      $this->_state = $state;

      try
      $this->_state->setAreaCode(MagentoFrameworkAppArea::AREA_ADMINHTML);
      catch (MagentoFrameworkExceptionLocalizedException $e)
      // nothing to do




      public function execute(MagentoFrameworkEventObserver $observer)


      $bootstrap = Bootstrap::create(BP, $_SERVER);
      $objectManager = $bootstrap->getObjectManager();
      $state = $objectManager->get('MagentoFrameworkAppState');
      $state->setAreaCode('frontend');
      $objDate = $objectManager->create('MagentoFrameworkStdlibDateTimeDateTime');
      $date = $objDate->gmtDate();

      $resource = $objectManager->get('MagentoFrameworkAppResourceConnection');
      $connection = $resource->getConnection();
      $orderId = $observer->getEvent()->getOrderIds()[0];

      $sql = "INSERT INTO custom_sap_orders (entity_id, order_id, sent, timestamp) Values (''," .
      $orderId .
      ", '" .
      "0" .
      "', '" .
      $date .
      "')" ;
      $connection->query($sql);





      But I get this error when I complete an order:



      1 exception(s):
      Exception #0 (MagentoFrameworkExceptionRuntimeException): Type Error occurred when creating object: MagentoCaptchaModelCheckoutConfigProvider

      Exception #0 (MagentoFrameworkExceptionRuntimeException): Type Error occurred when creating object: MagentoCaptchaModelCheckoutConfigProvider
      <pre>#1 MagentoFrameworkObjectManagerFactoryCompiled->create('MagentoCaptcha...') called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:150]
      #2 MagentoFrameworkObjectManagerFactoryCompiled->get('MagentoCaptcha...') called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:79]
      #3 MagentoFrameworkObjectManagerFactoryCompiled->create('MagentoCaptcha...') called at [vendor/magento/framework/ObjectManager/ObjectManager.php:70]
      #4 MagentoFrameworkObjectManagerObjectManager->get('MagentoCaptcha...') called at [vendor/magento/framework/Interception/PluginList/PluginList.php:250]
      #5 MagentoFrameworkInterceptionPluginListPluginList->getPlugin('MagentoCheckout...', 'login_captcha') called at [vendor/magento/framework/Interception/Interceptor.php:144]
      #6 MagentoCheckoutBlockCartSidebarInterceptor->MagentoFrameworkInterceptionclosure() called at [vendor/magento/framework/Interception/Interceptor.php:153]
      #7 MagentoCheckoutBlockCartSidebarInterceptor->___callPlugins('getConfig', array(), array(array('customer_cart', 'login_captcha'))) called at [generated/code/Magento/Checkout/Block/Cart/Sidebar/Interceptor.php:26]
      #8 MagentoCheckoutBlockCartSidebarInterceptor->getConfig() called at [app/design/frontend/Smartwave/porto/Magento_Checkout/templates/cart/minicart.phtml:45]
      #9 include('/var/www/html/ap...') called at [vendor/magento/framework/View/TemplateEngine/Php.php:59]
      #10 MagentoFrameworkViewTemplateEnginePhp->render(&MagentoCheckoutBlockCartSidebarInterceptor#0000000012d1f258000000005dbf9a65#, '/var/www/html/ap...', array()) called at [vendor/magento/framework/View/Element/Template.php:271]
      #11 MagentoFrameworkViewElementTemplate->fetchView('/var/www/html/ap...') called at [vendor/magento/framework/View/Element/Template.php:301]
      #12 MagentoFrameworkViewElementTemplate->_toHtml() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1094]
      #13 MagentoFrameworkViewElementAbstractBlock->MagentoFrameworkViewElementclosure() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1098]
      #14 MagentoFrameworkViewElementAbstractBlock->_loadCache() called at [vendor/magento/framework/View/Element/AbstractBlock.php:671]
      #15 MagentoFrameworkViewElementAbstractBlock->toHtml() called at [vendor/magento/framework/View/Layout.php:557]
      #16 MagentoFrameworkViewLayout->_renderBlock('minicart') called at [vendor/magento/framework/View/Layout.php:533]
      #17 MagentoFrameworkViewLayout->renderNonCachedElement('minicart') called at [vendor/magento/framework/View/Layout.php:488]
      #18 MagentoFrameworkViewLayout->renderElement('minicart', true) called at [vendor/magento/framework/View/Element/AbstractBlock.php:518]
      #19 MagentoFrameworkViewElementAbstractBlock->getChildHtml('minicart')
      #20 call_user_func_array(array(&SmartwavePortoBlockTemplate#0000000012d1f267000000005dbf9a65#, 'getChildHtml'), array('minicart')) called at [vendor/magento/framework/View/TemplateEngine/Php.php:82]
      #21 MagentoFrameworkViewTemplateEnginePhp->__call('getChildHtml', array('minicart')) called at [app/design/frontend/Smartwave/porto/Smartwave_Porto/templates/html/header.phtml:269]
      #22 include('/var/www/html/ap...') called at [vendor/magento/framework/View/TemplateEngine/Php.php:59]
      #23 MagentoFrameworkViewTemplateEnginePhp->render(&SmartwavePortoBlockTemplate#0000000012d1f267000000005dbf9a65#, '/var/www/html/ap...', array()) called at [vendor/magento/framework/View/Element/Template.php:271]
      #24 MagentoFrameworkViewElementTemplate->fetchView('/var/www/html/ap...') called at [vendor/magento/framework/View/Element/Template.php:301]
      #25 MagentoFrameworkViewElementTemplate->_toHtml() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1094]
      #26 MagentoFrameworkViewElementAbstractBlock->MagentoFrameworkViewElementclosure() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1098]
      #27 MagentoFrameworkViewElementAbstractBlock->_loadCache() called at [vendor/magento/framework/View/Element/AbstractBlock.php:671]
      #28 MagentoFrameworkViewElementAbstractBlock->toHtml() called at [vendor/magento/framework/View/Layout.php:557]
      #29 MagentoFrameworkViewLayout->_renderBlock('porto_header') called at [vendor/magento/framework/View/Layout.php:533]
      #30 MagentoFrameworkViewLayout->renderNonCachedElement('porto_header') called at [vendor/magento/framework/View/Layout.php:488]
      #31 MagentoFrameworkViewLayout->renderElement('porto_header', false) called at [vendor/magento/framework/View/Layout.php:585]
      #32 MagentoFrameworkViewLayout->_renderContainer('page.wrapper', false) called at [vendor/magento/framework/View/Layout.php:535]
      #33 MagentoFrameworkViewLayout->renderNonCachedElement('page.wrapper') called at [vendor/magento/framework/View/Layout.php:488]
      #34 MagentoFrameworkViewLayout->renderElement('page.wrapper', false) called at [vendor/magento/framework/View/Layout.php:585]
      #35 MagentoFrameworkViewLayout->_renderContainer('root', false) called at [vendor/magento/framework/View/Layout.php:535]
      #36 MagentoFrameworkViewLayout->renderNonCachedElement('root') called at [vendor/magento/framework/View/Layout.php:488]
      #37 MagentoFrameworkViewLayout->renderElement('root') called at [vendor/magento/framework/View/Layout.php:954]
      #38 MagentoFrameworkViewLayout->getOutput() called at [vendor/magento/framework/Interception/Interceptor.php:58]
      #39 MagentoFrameworkViewLayoutInterceptor->___callParent('getOutput', array()) called at [vendor/magento/framework/Interception/Interceptor.php:138]
      #40 MagentoFrameworkViewLayoutInterceptor->MagentoFrameworkInterceptionclosure() called at [vendor/magento/framework/Interception/Interceptor.php:153]
      #41 MagentoFrameworkViewLayoutInterceptor->___callPlugins('getOutput', array(), array(array('layout-model-cac...'))) called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:39]
      #42 MagentoFrameworkViewLayoutInterceptor->getOutput() called at [vendor/magento/framework/View/Result/Page.php:258]
      #43 MagentoFrameworkViewResultPage->render(&MagentoFrameworkAppResponseHttpInterceptor#0000000012d1f40e000000005dbf9a65#) called at [vendor/magento/framework/View/Result/Layout.php:171]
      #44 MagentoFrameworkViewResultLayout->renderResult(&MagentoFrameworkAppResponseHttpInterceptor#0000000012d1f40e000000005dbf9a65#) called at [vendor/magento/framework/Interception/Interceptor.php:58]
      #45 MagentoFrameworkViewResultPageInterceptor->___callParent('renderResult', array(&MagentoFrameworkAppResponseHttpInterceptor#0000000012d1f40e000000005dbf9a65#)) called at [vendor/magento/framework/Interception/Interceptor.php:138]
      #46 MagentoFrameworkViewResultPageInterceptor->MagentoFrameworkInterceptionclosure(&MagentoFrameworkAppResponseHttpInterceptor#0000000012d1f40e000000005dbf9a65#) called at [vendor/magento/framework/Interception/Interceptor.php:153]
      #47 MagentoFrameworkViewResultPageInterceptor->___callPlugins('renderResult', array(&MagentoFrameworkAppResponseHttpInterceptor#0000000012d1f40e000000005dbf9a65#), array(array('result-messages', 'result-builtin-c...', 'result-varnish-c...'))) called at [generated/code/Magento/Framework/View/Result/Page/Interceptor.php:39]
      #48 MagentoFrameworkViewResultPageInterceptor->renderResult(&MagentoFrameworkAppResponseHttpInterceptor#0000000012d1f40e000000005dbf9a65#) called at [vendor/magento/framework/App/Http.php:141]
      #49 MagentoFrameworkAppHttp->launch() called at [vendor/magento/framework/App/Bootstrap.php:261]
      #50 MagentoFrameworkAppBootstrap->run(&MagentoFrameworkAppHttpInterceptor#0000000012d1f408000000005dbf9a65#) called at [index.php:39]
      </pre>


      Any idea in order to solve it?







      module event-observer magento2.3 onepage-checkout object-manager






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 17 at 10:48







      Ángel Carlos del Pozo Muela

















      asked Jul 17 at 10:10









      Ángel Carlos del Pozo MuelaÁngel Carlos del Pozo Muela

      357 bronze badges




      357 bronze badges




















          1 Answer
          1






          active

          oldest

          votes


















          0














          Try to remove generation folder or in version 2.2 remove the generated folder.



          rm -rf generated/



          flush the cache. It should work then. its because the interceptor file needs to be re-created or refresh.



          I hope its working to you.






          share|improve this answer

























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "479"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f282363%2ferror-when-observer-is-executed-after-order-is-placed%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Try to remove generation folder or in version 2.2 remove the generated folder.



            rm -rf generated/



            flush the cache. It should work then. its because the interceptor file needs to be re-created or refresh.



            I hope its working to you.






            share|improve this answer



























              0














              Try to remove generation folder or in version 2.2 remove the generated folder.



              rm -rf generated/



              flush the cache. It should work then. its because the interceptor file needs to be re-created or refresh.



              I hope its working to you.






              share|improve this answer

























                0












                0








                0







                Try to remove generation folder or in version 2.2 remove the generated folder.



                rm -rf generated/



                flush the cache. It should work then. its because the interceptor file needs to be re-created or refresh.



                I hope its working to you.






                share|improve this answer













                Try to remove generation folder or in version 2.2 remove the generated folder.



                rm -rf generated/



                flush the cache. It should work then. its because the interceptor file needs to be re-created or refresh.



                I hope its working to you.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jul 17 at 11:25









                Anas MansuriAnas Mansuri

                1,1251 silver badge16 bronze badges




                1,1251 silver badge16 bronze badges



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f282363%2ferror-when-observer-is-executed-after-order-is-placed%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                    Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

                    Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?