48 \
Magento\Reports\Model\EventFactory $event,
49 \
Magento\Reports\Model\Product\Index\ComparedFactory $productCompFactory,
50 \
Magento\Reports\Model\Product\Index\ViewedFactory $productIndexFactory,
51 \
Magento\Customer\Model\Session $customerSession,
52 \
Magento\Customer\Model\Visitor $customerVisitor
54 $this->_eventFactory = $event;
55 $this->_productCompFactory = $productCompFactory;
56 $this->_productIndexFactory = $productIndexFactory;
57 $this->_customerSession = $customerSession;
58 $this->_customerVisitor = $customerVisitor;
70 if (!$this->_customerSession->isLoggedIn()) {
74 $visitorId = $this->_customerVisitor->getId();
75 $customerId = $this->_customerSession->getCustomerId();
76 $eventModel = $this->_eventFactory->create();
77 $eventModel->updateCustomerType($visitorId,
$customerId);
79 $this->_productCompFactory->create()->updateCustomerFromVisitor()->calculate();
80 $this->_productIndexFactory->create()->updateCustomerFromVisitor()->calculate();
__construct(\Magento\Reports\Model\EventFactory $event, \Magento\Reports\Model\Product\Index\ComparedFactory $productCompFactory, \Magento\Reports\Model\Product\Index\ViewedFactory $productIndexFactory, \Magento\Customer\Model\Session $customerSession, \Magento\Customer\Model\Visitor $customerVisitor)
execute(\Magento\Framework\Event\Observer $observer)