本文整理汇总了PHP中Magento\Framework\App\Action\Action::dispatch方法的典型用法代码示例。如果您正苦于以下问题:PHP Action::dispatch方法的具体用法?PHP Action::dispatch怎么用?PHP Action::dispatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\App\Action\Action
的用法示例。
在下文中一共展示了Action::dispatch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dispatch
/**
* {@inheritdoc}
*/
public function dispatch(\Magento\Framework\App\RequestInterface $request)
{
if (!$this->_getCheckout()->getCustomer()->getId()) {
return $this->_redirect('customer/account/login');
}
return parent::dispatch($request);
}
示例2: dispatch
/**
* Dispatch request
*
* @param RequestInterface $request
* @return ResponseInterface
* @throws NotFoundException
*/
public function dispatch(RequestInterface $request)
{
if (!$this->customerSession->authenticate()) {
$this->_actionFlag->set('', 'no-dispatch', true);
}
return parent::dispatch($request);
}
示例3: dispatch
/**
* Dispatch request
*
* @param RequestInterface $request
* @return \Magento\Framework\App\ResponseInterface
* @throws \Magento\Framework\Exception\NotFoundException
*/
public function dispatch(RequestInterface $request)
{
if (!$this->scopeConfig->isSetFlag(self::XML_PATH_ENABLED, ScopeInterface::SCOPE_STORE)) {
throw new NotFoundException(__('Page not found.'));
}
return parent::dispatch($request);
}
示例4: dispatch
/**
* @param \Magento\Framework\App\RequestInterface $request
* @return \Magento\Framework\App\ResponseInterface
*/
public function dispatch(\Magento\Framework\App\RequestInterface $request)
{
if (!$this->_isAllowed()) {
throw new NotFoundException(__('Page not found.'));
}
return parent::dispatch($request);
}
示例5: dispatch
/**
* Check customer authentication for some actions
*
* @param \Magento\Framework\App\RequestInterface $request
* @return \Magento\Framework\App\ResponseInterface
*/
public function dispatch(RequestInterface $request)
{
if (!$this->customerSession->authenticate()) {
$this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
}
return parent::dispatch($request);
}
示例6: dispatch
/**
* Dispatch request
*
* @param RequestInterface $request
* @return \Magento\Framework\App\ResponseInterface
*/
public function dispatch(RequestInterface $request)
{
if (!$this->getRequest()->isDispatched()) {
parent::dispatch($request);
}
$result = parent::dispatch($request);
return $result;
}
示例7: dispatch
/**
* Check customer authentication
*
* @param RequestInterface $request
* @return \Magento\Framework\App\ResponseInterface
*/
public function dispatch(RequestInterface $request)
{
$loginUrl = $this->_objectManager->get('Magento\\Customer\\Model\\Url')->getLoginUrl();
if (!$this->_customerSession->authenticate($this, $loginUrl)) {
$this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
}
return parent::dispatch($request);
}
示例8: dispatch
/**
* Dispatch request
*
* @param RequestInterface $request
* @return ResponseInterface
*/
public function dispatch(RequestInterface $request)
{
$searchTerms = $this->scopeConfig->getValue('catalog/seo/search_terms', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
if (!$searchTerms) {
$this->_redirect('noroute');
$this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
}
return parent::dispatch($request);
}
示例9: dispatch
/**
* Check customer authentication
*
* @param RequestInterface $request
* @return \Magento\Framework\App\ResponseInterface
*/
public function dispatch(RequestInterface $request)
{
if (!$request->isDispatched()) {
return parent::dispatch($request);
}
if (!$this->_getSession()->authenticate($this)) {
$this->_actionFlag->set('', 'no-dispatch', true);
}
return parent::dispatch($request);
}
示例10: dispatch
/**
* Dispatch request
*
* @param RequestInterface $request
* @return \Magento\Framework\App\ResponseInterface
*/
public function dispatch(RequestInterface $request)
{
// Check this module is enabled in frontend
if ($this->_dataHelper->isEnabledInFrontend()) {
$result = parent::dispatch($request);
return $result;
} else {
$this->_forward('noroute');
}
}
示例11: dispatch
/**
* Check customer authentication for some actions
*
* @param \Magento\Framework\App\RequestInterface $request
* @return \Magento\Framework\App\ResponseInterface
*/
public function dispatch(RequestInterface $request)
{
if (!$this->customerSession->authenticate()) {
$this->_actionFlag->set('', 'no-dispatch', true);
if (!$this->customerSession->getBeforeUrl()) {
$this->customerSession->setBeforeUrl($this->_redirect->getRefererUrl());
}
}
return parent::dispatch($request);
}
示例12: dispatch
public function dispatch(RequestInterface $request)
{
if (!$this->session->isLoggedIn()) {
return $this->_redirect('customer/account/login');
}
if (!$this->config->isEnabled()) {
return $this->_redirect($this->_redirect->getRefererUrl());
}
return parent::dispatch($request);
}
示例13: dispatch
/**
* Check whether payment method is enabled
*
* @param RequestInterface $request
* @return \Magento\Framework\Controller\Result\Redirect|\Magento\Framework\App\ResponseInterface
*/
public function dispatch(RequestInterface $request)
{
if (!$this->braintreePayPalConfig->isActive() || !$this->braintreePayPalConfig->isShortcutCheckoutEnabled()) {
$this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
/** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
$resultRedirect = $this->resultRedirectFactory->create();
$resultRedirect->setPath('noRoute');
return $resultRedirect;
}
return parent::dispatch($request);
}
示例14: dispatch
/**
* Check whether payment method is enabled
*
* @inheritdoc
*/
public function dispatch(RequestInterface $request)
{
if (!$this->config->isActive() || !$this->config->isDisplayShoppingCart()) {
$this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
/** @var Redirect $resultRedirect */
$resultRedirect = $this->resultRedirectFactory->create();
$resultRedirect->setPath('noRoute');
return $resultRedirect;
}
return parent::dispatch($request);
}
示例15: dispatch
/**
* Make sure customer is logged in and put it into registry
*
* @param RequestInterface $request
* @return \Magento\Framework\App\ResponseInterface
*/
public function dispatch(RequestInterface $request)
{
if (!$request->isDispatched()) {
return parent::dispatch($request);
}
if (!$this->_customerSession->authenticate($this)) {
$this->_actionFlag->set('', 'no-dispatch', true);
}
$customer = $this->_customerSession->getCustomer();
$this->_coreRegistry->register(RegistryConstants::CURRENT_CUSTOMER, $customer);
$this->_coreRegistry->register(RegistryConstants::CURRENT_CUSTOMER_ID, $customer->getId());
return parent::dispatch($request);
}