Guest User

Untitled

a guest
Dec 10th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. <event name="checkout_onepage_controller_success_action">
  2. <observer name="namespace_module_sales_order_save_after" instance="NamespaceModuleObserverAfterOrder" />
  3. </event>
  4.  
  5. use PsrLogLoggerInterface;
  6. class AfterOrder implements ObserverInterface
  7. {
  8. protected $_checkoutSession;
  9. protected $_customerRepositoryInterface;
  10. protected $_addressInterface;
  11.  
  12. public function __construct(
  13. LoggerInterface $loggerInterface,
  14. MagentoFrameworkRegistry $registry,
  15. MagentoSalesModelOrderFactory $orderFactory,
  16. MagentoQuoteModelQuoteFactory $quoteFactory
  17. )
  18. {
  19. $this->_logger = $loggerInterface;
  20. $this->orderFactory = $orderFactory;
  21. $this->registry = $registry;
  22. $this->quoteFactory = $quoteFactory;
  23. }
  24.  
  25. public function execute(MagentoFrameworkEventObserver $observer)
  26. {
  27. $orderId = $observer->getEvent()->getOrderIds();
  28. $objectManager = MagentoFrameworkAppObjectManager::getInstance();
  29. $order = $objectManager->create('MagentoSalesModelOrder')->load($orderId[0]);
  30. $quote = $this->quoteFactory->create()->load($order->getQuoteId());
  31. echo $order->getQuoteId(); exit;
  32. }
  33. }
  34.  
  35. $shippingAddress = $this->checkoutSession->getLastRealOrder()->getShippingAddress();
Add Comment
Please, Sign In to add comment