/** * After generate Xml * * @param \Magento\Framework\View\LayoutInterface $subject * @param \Magento\Framework\View\LayoutInterface $result * @return \Magento\Framework\View\LayoutInterface */ public function afterGenerateXml(\Magento\Framework\View\LayoutInterface $subject, $result) { if ($this->moduleManager->isEnabled('Magento_PageCache') && $this->cacheConfig->isEnabled() && !$this->request->isAjax() && $subject->isCacheable()) { $this->checkoutSession->clearStorage(); } return $result; }
/** * Returns current customer according to session and context * * @return \Magento\Customer\Service\V1\Data\Customer */ public function getCustomer() { if ($this->moduleManager->isEnabled('Magento_PageCache') && !$this->request->isAjax() && $this->view->isLayoutLoaded() && $this->layout->isCacheable()) { return $this->getDepersonalizedCustomer(); } else { return $this->getCustomerFromService(); } }
/** * After generate Xml * * @param \Magento\Framework\View\LayoutInterface $subject * @param \Magento\Framework\View\LayoutInterface $result * @return \Magento\Framework\View\LayoutInterface */ public function afterGenerateXml(\Magento\Framework\View\LayoutInterface $subject, $result) { if ($this->moduleManager->isEnabled('Magento_PageCache') && $this->cacheConfig->isEnabled() && !$this->request->isAjax() && $subject->isCacheable()) { $this->eventManager->dispatch('depersonalize_clear_session'); session_write_close(); $this->messageSession->clearStorage(); } return $result; }
/** * Check if depersonalize or not * * @param \Magento\Framework\View\LayoutInterface $subject * @return bool * @api */ public function checkIfDepersonalize(\Magento\Framework\View\LayoutInterface $subject) { return $this->moduleManager->isEnabled('Magento_PageCache') && $this->cacheConfig->isEnabled() && !$this->request->isAjax() && ($this->request->isGet() || $this->request->isHead()) && $subject->isCacheable(); }
/** * Constructor * * @param LayoutFactory $layoutFactory * @param LayoutInterface $generalLayout */ public function __construct(LayoutFactory $layoutFactory, \Magento\Framework\View\LayoutInterface $generalLayout) { $this->layout = $layoutFactory->create(['cacheable' => $generalLayout->isCacheable()]); }
/** * After generate Xml * * @param \Magento\Framework\View\LayoutInterface $subject * @param \Magento\Framework\View\LayoutInterface $result * @return \Magento\Framework\View\LayoutInterface */ public function afterGenerateXml(\Magento\Framework\View\LayoutInterface $subject, $result) { if ($this->moduleManager->isEnabled('Magento_PageCache') && $this->cacheConfig->isEnabled() && !$this->request->isAjax() && $subject->isCacheable()) { $this->visitor->setSkipRequestLogging(true); $this->visitor->unsetData(); $this->session->clearStorage(); $this->customerSession->clearStorage(); $this->session->setData(\Magento\Framework\Data\Form\FormKey::FORM_KEY, $this->formKey); $this->customerSession->setCustomerGroupId($this->customerGroupId); $this->customer->setGroupId($this->customerGroupId); $this->customerSession->setCustomer($this->customer); } return $result; }