Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
LoadCustomerQuoteObserver.php
Go to the documentation of this file.
1 <?php
7 
9 
11 {
15  protected $checkoutSession;
16 
20  protected $messageManager;
21 
27  public function __construct(
28  \Magento\Checkout\Model\Session $checkoutSession,
29  \Magento\Framework\Message\ManagerInterface $messageManager
30  ) {
31  $this->checkoutSession = $checkoutSession;
32  $this->messageManager = $messageManager;
33  }
34 
40  public function execute(\Magento\Framework\Event\Observer $observer)
41  {
42  try {
43  $this->checkoutSession->loadCustomerQuote();
44  } catch (\Magento\Framework\Exception\LocalizedException $e) {
45  $this->messageManager->addErrorMessage($e->getMessage());
46  } catch (\Exception $e) {
47  $this->messageManager->addExceptionMessage($e, __('Load customer quote error'));
48  }
49  }
50 }
__()
Definition: __.php:13
__construct(\Magento\Checkout\Model\Session $checkoutSession, \Magento\Framework\Message\ManagerInterface $messageManager)
execute(\Magento\Framework\Event\Observer $observer)