Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SetLoadPersistentQuoteObserver.php
Go to the documentation of this file.
1 <?php
8 
10 
12 {
18  protected $_customerSession;
19 
25  protected $_checkoutSession;
26 
32  protected $_persistentSession = null;
33 
39  protected $_persistentData = null;
40 
47  public function __construct(
48  \Magento\Persistent\Helper\Session $persistentSession,
49  \Magento\Persistent\Helper\Data $persistentData,
50  \Magento\Customer\Model\Session $customerSession,
51  \Magento\Checkout\Model\Session $checkoutSession
52  ) {
53  $this->_persistentSession = $persistentSession;
54  $this->_customerSession = $customerSession;
55  $this->_checkoutSession = $checkoutSession;
56  $this->_persistentData = $persistentData;
57  }
58 
66  public function execute(\Magento\Framework\Event\Observer $observer)
67  {
68  if (!(($this->_persistentSession->isPersistent() && !$this->_customerSession->isLoggedIn())
69  && !$this->_persistentData->isShoppingCartPersist()
70  )) {
71  return;
72  }
73 
74  if ($this->_checkoutSession) {
75  $this->_checkoutSession->setLoadInactive();
76  }
77  }
78 }
__construct(\Magento\Persistent\Helper\Session $persistentSession, \Magento\Persistent\Helper\Data $persistentData, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession)
$persistentSession
Definition: persistent.php:11