當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Session::setBeforeAuthUrl方法代碼示例

本文整理匯總了PHP中Magento\Customer\Model\Session::setBeforeAuthUrl方法的典型用法代碼示例。如果您正苦於以下問題:PHP Session::setBeforeAuthUrl方法的具體用法?PHP Session::setBeforeAuthUrl怎麽用?PHP Session::setBeforeAuthUrl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Customer\Model\Session的用法示例。


在下文中一共展示了Session::setBeforeAuthUrl方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: redirectLogin

 /**
  * Performs redirect to login for checkout
  * @param RedirectLoginInterface $expressRedirect
  * @param string|null $customerBeforeAuthUrlDefault
  * @return void
  */
 public function redirectLogin(RedirectLoginInterface $expressRedirect, $customerBeforeAuthUrlDefault = null)
 {
     $this->_actionFlag->set('', 'no-dispatch', true);
     foreach ($expressRedirect->getActionFlagList() as $actionKey => $actionFlag) {
         $this->_actionFlag->set('', $actionKey, $actionFlag);
     }
     $expressRedirect->getResponse()->setRedirect($this->_objectManager->get('Magento\\Framework\\Url\\Helper\\Data')->addRequestParam($expressRedirect->getLoginUrl(), ['context' => 'checkout']));
     $customerBeforeAuthUrl = $customerBeforeAuthUrlDefault;
     if ($expressRedirect->getCustomerBeforeAuthUrl()) {
         $customerBeforeAuthUrl = $expressRedirect->getCustomerBeforeAuthUrl();
     }
     if ($customerBeforeAuthUrl) {
         $this->_customerSession->setBeforeAuthUrl($customerBeforeAuthUrl);
     }
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:21,代碼來源:ExpressRedirect.php

示例2: dispatch

 /**
  * Dispatch request
  *
  * @param RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function dispatch(RequestInterface $request)
 {
     $allowGuest = $this->_objectManager->get('Magento\\Review\\Helper\\Data')->getIsGuestAllowToWrite();
     if (!$request->isDispatched()) {
         return parent::dispatch($request);
     }
     if (!$allowGuest && $request->getActionName() == 'post' && $request->isPost()) {
         if (!$this->_customerSession->isLoggedIn()) {
             $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
             $this->_customerSession->setBeforeAuthUrl($this->_url->getUrl('*/*/*', ['_current' => true]));
             $this->_reviewSession->setFormData($request->getPostValue())->setRedirectUrl($this->_redirect->getRefererUrl());
             $this->getResponse()->setRedirect($this->_objectManager->get('Magento\\Customer\\Model\\Url')->getLoginUrl());
         }
     }
     return parent::dispatch($request);
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:22,代碼來源:Product.php

示例3: redirectLogin

 /**
  * Redirect to login page
  *
  * @return void
  */
 public function redirectLogin()
 {
     $this->_actionFlag->set('', 'no-dispatch', true);
     $this->_customerSession->setBeforeAuthUrl($this->_redirect->getRefererUrl());
     $this->getResponse()->setRedirect($this->_urlHelper->addRequestParam($this->_customerUrl->getLoginUrl(), ['context' => 'checkout']));
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:11,代碼來源:AbstractExpress.php


注:本文中的Magento\Customer\Model\Session::setBeforeAuthUrl方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。