Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected $customerSession;
- protected $urlInterface;
- public function __construct(
- MagentoCustomerModelSession $customerSession,
- MagentoFrameworkUrlInterface $urlInterface,
- ...
- )
- {
- $this->urlInterface = $urlInterface;
- $this->customerSession = $customerSession;
- ...
- }
- public function execute()
- {
- //Redirect to login page if customer is not logged in
- if(!$this->customerSession->isLoggedIn()) {
- $this->customerSession->setAfterAuthUrl($this->urlInterface->getCurrentUrl());
- $this->customerSession->authenticate();
- }
- ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement