Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <event name="checkout_onepage_controller_success_action">
- <observer name="namespace_module_sales_order_save_after" instance="NamespaceModuleObserverAfterOrder" />
- </event>
- use PsrLogLoggerInterface;
- class AfterOrder implements ObserverInterface
- {
- protected $_checkoutSession;
- protected $_customerRepositoryInterface;
- protected $_addressInterface;
- public function __construct(
- LoggerInterface $loggerInterface,
- MagentoFrameworkRegistry $registry,
- MagentoSalesModelOrderFactory $orderFactory,
- MagentoQuoteModelQuoteFactory $quoteFactory
- )
- {
- $this->_logger = $loggerInterface;
- $this->orderFactory = $orderFactory;
- $this->registry = $registry;
- $this->quoteFactory = $quoteFactory;
- }
- public function execute(MagentoFrameworkEventObserver $observer)
- {
- $orderId = $observer->getEvent()->getOrderIds();
- $objectManager = MagentoFrameworkAppObjectManager::getInstance();
- $order = $objectManager->create('MagentoSalesModelOrder')->load($orderId[0]);
- $quote = $this->quoteFactory->create()->load($order->getQuoteId());
- echo $order->getQuoteId(); exit;
- }
- }
- $shippingAddress = $this->checkoutSession->getLastRealOrder()->getShippingAddress();
Add Comment
Please, Sign In to add comment