Guest User

Untitled

a guest
Feb 21st, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. use MagentoCustomerModelContext as CustomerContext;
  2. use MagentoCustomerModelContext;
  3. use MagentoFrameworkAppHttpContext as HttpContext;
  4.  
  5. /**
  6. * @param HttpContext $httpContext
  7. */
  8. public function __construct(HttpContext $httpContext)
  9. {
  10. $this->httpContext = $httpContext;
  11. }
  12.  
  13.  
  14. /**
  15. * @return bool
  16. */
  17. private function isLoggedIn()
  18. {
  19. return (bool)$this->httpContext->getValue(Context::CONTEXT_AUTH);
  20. }
  21.  
  22. if (null === $customerId) {
  23. if ($this->httpContext->getValue(CustomerContext::CONTEXT_AUTH)) {
  24. if (!$this->session->isSessionExists()) {
  25. $this->session->start();
  26. }
  27.  
  28. $visitorData = $this->session->getData('visitor_data');
  29. if (isset($visitorData['customer_id'])) {
  30. $customerId = $visitorData['customer_id'];
  31. }
  32. }
  33. }
Add Comment
Please, Sign In to add comment