![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/app/code/Magecomp/Savecartpro/Controller/Index/ |
<?php namespace Magecomp\Savecartpro\Controller\Index; class View extends \Magento\Framework\App\Action\Action { protected $custsession; protected $_responseFactory; protected $_url; public function __construct(\Magento\Framework\App\Action\Context $context, \Magento\Customer\Model\Session $custsession, \Magento\Framework\App\ResponseFactory $responseFactory) { $this->custsession = $custsession; $this->_responseFactory = $responseFactory; parent::__construct($context); } public function execute() { if($this->custsession->isLoggedIn()) { $this->_view->loadLayout(); $this->_view->renderLayout(); } else { $accUrl = $this->_url->getUrl('customer/account/login'); $this->_responseFactory->create()->setRedirect($accUrl)->sendResponse(); $this->setRefererUrl($accUrl); } } }