Ejemplo n.º 1
0
 /**
  * Dispatch request
  *
  * @param \Magento\Framework\App\Action\Action $subject
  * @param callable $proceed
  * @param \Magento\Framework\App\RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function aroundDispatch(\Magento\Framework\App\Action\Action $subject, \Closure $proceed, \Magento\Framework\App\RequestInterface $request)
 {
     if (!$this->_appState->isInstalled()) {
         $this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
         $this->_response->setRedirect($this->_url->getUrl('install'));
         return $this->_response;
     }
     return $proceed($request);
 }
 /**
  * Log out user and redirect to new admin custom url
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  * @SuppressWarnings(PHPMD.ExitExpression)
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     if ($this->_coreRegistry->registry('custom_admin_path_redirect') === null) {
         return;
     }
     $this->_authSession->destroy();
     $adminUrl = $this->_backendData->getHomePageUrl();
     $this->_response->setRedirect($adminUrl)->sendResponse();
     exit(0);
 }
Ejemplo n.º 3
0
 /**
  * Log out user and redirect him to new admin custom url
  *
  * @return void
  * @SuppressWarnings(PHPMD.ExitExpression)
  */
 public function afterCustomUrlChanged()
 {
     if (is_null($this->_coreRegistry->registry('custom_admin_path_redirect'))) {
         return;
     }
     $this->_authSession->destroy();
     $route = $this->_backendData->getAreaFrontName();
     $this->_response->setRedirect($this->_storeManager->getStore()->getBaseUrl() . $route)->sendResponse();
     exit(0);
 }
 /**
  * Log out user and redirect him to new admin custom url
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  * @SuppressWarnings(PHPMD.ExitExpression)
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     if ($this->_coreRegistry->registry('custom_admin_path_redirect') === null) {
         return;
     }
     $this->_authSession->destroy();
     $route = $this->_backendData->getAreaFrontName();
     $this->_response->setRedirect($this->_storeManager->getStore()->getBaseUrl() . $route)->sendResponse();
     exit(0);
 }
Ejemplo n.º 5
0
 /**
  * Validate and Match Blog Pages and modify request
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @return bool
  */
 public function match(\Magento\Framework\App\RequestInterface $request)
 {
     $_identifier = trim($request->getPathInfo(), '/');
     if (strpos($_identifier, 'blog') !== 0) {
         return;
     }
     $identifier = str_replace(array('blog/', 'blog'), '', $_identifier);
     $condition = new \Magento\Framework\DataObject(['identifier' => $identifier, 'continue' => true]);
     $this->_eventManager->dispatch('magefan_blog_controller_router_match_before', ['router' => $this, 'condition' => $condition]);
     if ($condition->getRedirectUrl()) {
         $this->_response->setRedirect($condition->getRedirectUrl());
         $request->setDispatched(true);
         return $this->actionFactory->create('Magento\\Framework\\App\\Action\\Redirect', ['request' => $request]);
     }
     if (!$condition->getContinue()) {
         return null;
     }
     $identifier = $condition->getIdentifier();
     $success = false;
     $info = explode('/', $identifier);
     if (!$identifier) {
         $request->setModuleName('blog')->setControllerName('index')->setActionName('index');
         $success = true;
     } elseif (count($info) > 1) {
         $store = $this->_storeManager->getStore()->getId();
         switch ($info[0]) {
             case 'post':
                 $post = $this->_postFactory->create();
                 $postId = $post->checkIdentifier($info[1], $this->_storeManager->getStore()->getId());
                 if (!$postId) {
                     return null;
                 }
                 $request->setModuleName('blog')->setControllerName('post')->setActionName('view')->setParam('id', $postId);
                 $success = true;
                 break;
             case 'category':
                 $category = $this->_categoryFactory->create();
                 $categoryId = $category->checkIdentifier($info[1], $this->_storeManager->getStore()->getId());
                 if (!$categoryId) {
                     return null;
                 }
                 $request->setModuleName('blog')->setControllerName('category')->setActionName('view')->setParam('id', $categoryId);
                 $success = true;
                 break;
             case 'archive':
                 $request->setModuleName('blog')->setControllerName('archive')->setActionName('view')->setParam('date', $info[1]);
                 $success = true;
                 break;
             case 'search':
                 $request->setModuleName('blog')->setControllerName('search')->setActionName('index')->setParam('q', $info[1]);
                 $success = true;
                 break;
         }
     }
     if (!$success) {
         return null;
     }
     $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $_identifier);
     return $this->actionFactory->create('Magento\\Framework\\App\\Action\\Forward', ['request' => $request]);
 }
Ejemplo n.º 6
0
 /**
  * Validate and Match Cms Page and modify request
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @return bool
  *
  * @SuppressWarnings(PHPMD.ExitExpression)
  */
 public function match(\Magento\Framework\App\RequestInterface $request)
 {
     if (!$this->_appState->isInstalled()) {
         $this->_response->setRedirect($this->_url->getUrl('install'))->sendResponse();
         exit;
     }
     $identifier = trim($request->getPathInfo(), '/');
     $condition = new \Magento\Framework\Object(array('identifier' => $identifier, 'continue' => true));
     $this->_eventManager->dispatch('cms_controller_router_match_before', array('router' => $this, 'condition' => $condition));
     $identifier = $condition->getIdentifier();
     if ($condition->getRedirectUrl()) {
         $this->_response->setRedirect($condition->getRedirectUrl());
         $request->setDispatched(true);
         return $this->actionFactory->create('Magento\\Framework\\App\\Action\\Redirect', array('request' => $request));
     }
     if (!$condition->getContinue()) {
         return null;
     }
     /** @var \Magento\Cms\Model\Page $page */
     $page = $this->_pageFactory->create();
     $pageId = $page->checkIdentifier($identifier, $this->_storeManager->getStore()->getId());
     if (!$pageId) {
         return null;
     }
     $request->setModuleName('cms')->setControllerName('page')->setActionName('view')->setParam('page_id', $pageId);
     $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $identifier);
     return $this->actionFactory->create('Magento\\Framework\\App\\Action\\Forward', array('request' => $request));
 }
Ejemplo n.º 7
0
 /**
  * Validate and Match Cms Page and modify request
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @return mixed
  */
 public function match(\Magento\Framework\App\RequestInterface $request)
 {
     $identifier = trim($request->getPathInfo(), '/');
     $urlRewrite = $this->urlMatcher->match($identifier, $this->storeManager->getStore()->getId());
     if ($urlRewrite === null) {
         return null;
     }
     $redirectType = $urlRewrite->getRedirectType();
     if ($redirectType) {
         $redirectCode = $redirectType == \Magento\UrlRedirect\Model\OptionProvider::PERMANENT ? 301 : 302;
         $this->response->setRedirect($urlRewrite->getTargetPath(), $redirectCode);
         $request->setDispatched(true);
         return $this->actionFactory->createController('Magento\\Framework\\App\\Action\\Redirect', array('request' => $request));
     }
     $request->setPathInfo('/' . $urlRewrite->getTargetPath());
     return $this->actionFactory->createController('Magento\\Framework\\App\\Action\\Forward', array('request' => $request));
 }
Ejemplo n.º 8
0
 /**
  * Validate and Match News Author and modify request
  * @param \Magento\Framework\App\RequestInterface $request
  * @return bool
  * //TODO: maybe remove this and use the url rewrite table.
  */
 public function match(RequestInterface $request)
 {
     if (!$this->dispatched) {
         $urlKey = trim($request->getPathInfo(), '/');
         $origUrlKey = $urlKey;
         /** @var Object $condition */
         $condition = new Object(['url_key' => $urlKey, 'continue' => true]);
         $this->eventManager->dispatch('sample_news_controller_router_match_before', ['router' => $this, 'condition' => $condition]);
         $urlKey = $condition->getUrlKey();
         if ($condition->getRedirectUrl()) {
             $this->response->setRedirect($condition->getRedirectUrl());
             $request->setDispatched(true);
             return $this->actionFactory->create('Magento\\Framework\\App\\Action\\Redirect', ['request' => $request]);
         }
         if (!$condition->getContinue()) {
             return null;
         }
         $entities = ['author' => ['prefix' => $this->scopeConfig->getValue('sample_news/author/url_prefix', ScopeInterface::SCOPE_STORES), 'suffix' => $this->scopeConfig->getValue('sample_news/author/url_suffix', ScopeInterface::SCOPE_STORES), 'list_key' => $this->scopeConfig->getValue('sample_news/author/list_url', ScopeInterface::SCOPE_STORES), 'list_action' => 'index', 'factory' => $this->authorFactory, 'controller' => 'author', 'action' => 'view', 'param' => 'id']];
         foreach ($entities as $entity => $settings) {
             if ($settings['list_key']) {
                 if ($urlKey == $settings['list_key']) {
                     $request->setModuleName('sample_news')->setControllerName($settings['controller'])->setActionName($settings['list_action']);
                     $request->setAlias(Url::REWRITE_REQUEST_PATH_ALIAS, $urlKey);
                     $this->dispatched = true;
                     return $this->actionFactory->create('Magento\\Framework\\App\\Action\\Forward', ['request' => $request]);
                 }
             }
             if ($settings['prefix']) {
                 $parts = explode('/', $urlKey);
                 if ($parts[0] != $settings['prefix'] || count($parts) != 2) {
                     continue;
                 }
                 $urlKey = $parts[1];
             }
             if ($settings['suffix']) {
                 $suffix = substr($urlKey, -strlen($settings['suffix']) - 1);
                 if ($suffix != '.' . $settings['suffix']) {
                     continue;
                 }
                 $urlKey = substr($urlKey, 0, -strlen($settings['suffix']) - 1);
             }
             /** @var \Sample\News\Model\Author $instance */
             $instance = $settings['factory']->create();
             $id = $instance->checkUrlKey($urlKey, $this->storeManager->getStore()->getId());
             if (!$id) {
                 return null;
             }
             $request->setModuleName('sample_news')->setControllerName('author')->setActionName('view')->setParam('id', $id);
             $request->setAlias(Url::REWRITE_REQUEST_PATH_ALIAS, $origUrlKey);
             $request->setDispatched(true);
             $this->dispatched = true;
             return $this->actionFactory->create('Magento\\Framework\\App\\Action\\Forward', ['request' => $request]);
         }
     }
     return null;
 }
Ejemplo n.º 9
0
 /**
  * Checks, whether Magento requires redirection after successful admin login, and redirects user, if needed
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @return bool
  */
 protected function _redirectIfNeededAfterLogin(\Magento\Framework\App\RequestInterface $request)
 {
     $requestUri = null;
     // Checks, whether secret key is required for admin access or request uri is explicitly set
     if ($this->_url->useSecretKey()) {
         $requestUri = $this->_url->getUrl('*/*/*', ['_current' => true]);
     } elseif ($request) {
         $requestUri = $request->getRequestUri();
     }
     if (!$requestUri) {
         return false;
     }
     $this->_response->setRedirect($requestUri);
     $this->_actionFlag->set('', \Magento\Framework\App\ActionInterface::FLAG_NO_DISPATCH, true);
     return true;
 }
Ejemplo n.º 10
0
 /**
  * @param RequestInterface $request
  * @param ResponseInterface $response
  * @return bool
  */
 public function load(RequestInterface $request, ResponseInterface $response)
 {
     $orderId = (int) $request->getParam('order_id');
     if (!$orderId) {
         $request->initForward();
         $request->setActionName('noroute');
         $request->setDispatched(false);
         return false;
     }
     $order = $this->orderFactory->create()->load($orderId);
     if ($this->orderAuthorization->canView($order)) {
         $this->registry->register('current_order', $order);
         return true;
     }
     $response->setRedirect($this->url->getUrl('*/*/history'));
     return false;
 }
Ejemplo n.º 11
0
 /**
  * Set redirect into response
  *
  * @param \Magento\Framework\App\ResponseInterface $response
  * @param string $path
  * @param array $arguments
  * @return void
  */
 public function redirect(\Magento\Framework\App\ResponseInterface $response, $path, $arguments = [])
 {
     $arguments = $this->updatePathParams($arguments);
     $response->setRedirect($this->_urlBuilder->getUrl($path, $arguments));
 }
Ejemplo n.º 12
0
 /**
  * @param \Magento\Framework\App\RequestInterface $request
  * @param string $url
  * @param int $code
  * @return \Magento\Framework\App\ActionInterface
  */
 protected function redirect($request, $url, $code)
 {
     $this->response->setRedirect($url, $code);
     $request->setDispatched(true);
     return $this->actionFactory->create('Magento\\Framework\\App\\Action\\Redirect', ['request' => $request]);
 }
Ejemplo n.º 13
0
 /**
  * Try to load valid order by $_POST or $_COOKIE
  *
  * @param App\RequestInterface $request
  * @param App\ResponseInterface $response
  * @return bool
  */
 public function loadValidOrder(App\RequestInterface $request, App\ResponseInterface $response)
 {
     if ($this->_customerSession->isLoggedIn()) {
         $response->setRedirect($this->_urlBuilder->getUrl('sales/order/history'));
         return false;
     }
     $post = $request->getPost();
     $errors = false;
     /** @var $order \Magento\Sales\Model\Order */
     $order = $this->_orderFactory->create();
     if (empty($post) && !$this->_coreCookie->get(self::COOKIE_NAME)) {
         $response->setRedirect($this->_urlBuilder->getUrl('sales/guest/form'));
         return false;
     } elseif (!empty($post) && isset($post['oar_order_id']) && isset($post['oar_type'])) {
         $type = $post['oar_type'];
         $incrementId = $post['oar_order_id'];
         $lastName = $post['oar_billing_lastname'];
         $email = $post['oar_email'];
         $zip = $post['oar_zip'];
         if (empty($incrementId) || empty($lastName) || empty($type) || !in_array($type, array('email', 'zip')) || $type == 'email' && empty($email) || $type == 'zip' && empty($zip)) {
             $errors = true;
         }
         if (!$errors) {
             $order->loadByIncrementId($incrementId);
         }
         $errors = true;
         if ($order->getId()) {
             $billingAddress = $order->getBillingAddress();
             if (strtolower($lastName) == strtolower($billingAddress->getLastname()) && ($type == 'email' && strtolower($email) == strtolower($billingAddress->getEmail()) || $type == 'zip' && strtolower($zip) == strtolower($billingAddress->getPostcode()))) {
                 $errors = false;
             }
         }
         if (!$errors) {
             $toCookie = base64_encode($order->getProtectCode() . ':' . $incrementId);
             $this->_coreCookie->set(self::COOKIE_NAME, $toCookie, self::COOKIE_LIFETIME, self::COOKIE_PATH);
         }
     } elseif ($this->_coreCookie->get(self::COOKIE_NAME)) {
         $fromCookie = $this->_coreCookie->get(self::COOKIE_NAME);
         $cookieData = explode(':', base64_decode($fromCookie));
         $protectCode = isset($cookieData[0]) ? $cookieData[0] : null;
         $incrementId = isset($cookieData[1]) ? $cookieData[1] : null;
         $errors = true;
         if (!empty($protectCode) && !empty($incrementId)) {
             $order->loadByIncrementId($incrementId);
             if ($order->getProtectCode() == $protectCode) {
                 $this->_coreCookie->renew(self::COOKIE_NAME, self::COOKIE_LIFETIME, self::COOKIE_PATH);
                 $errors = false;
             }
         }
     }
     if (!$errors && $order->getId()) {
         $this->_coreRegistry->register('current_order', $order);
         return true;
     }
     $this->messageManager->addError(__('You entered incorrect data. Please try again.'));
     $response->setRedirect($this->_urlBuilder->getUrl('sales/guest/form'));
     return false;
 }
Ejemplo n.º 14
0
 /**
  * Set redirect into response
  *
  * @param   string $path
  * @param   array $arguments
  * @return \Magento\Framework\App\ResponseInterface
  * @TODO move method
  */
 protected function _redirect($path, $arguments = [])
 {
     $this->_session->setIsUrlNotice($this->_flag->get('', \Magento\Backend\App\AbstractAction::FLAG_IS_URLS_CHECKED));
     $this->_response->setRedirect($this->_helper->getUrl($path, $arguments));
     return $this->_response;
 }
Ejemplo n.º 15
0
 /**
  * Set redirect into response
  *
  * @param \Magento\Framework\App\ResponseInterface $response
  * @param string $path
  * @param array $arguments
  * @return void
  */
 public function redirect(\Magento\Framework\App\ResponseInterface $response, $path, $arguments = array())
 {
     if ($this->_session->getCookieShouldBeReceived() && $this->_urlBuilder->getUseSession() && $this->_canUseSessionIdInParam) {
         $arguments += array('_query' => array($this->_sidResolver->getSessionIdQueryParam($this->_session) => $this->_session->getSessionId()));
     }
     $response->setRedirect($this->_urlBuilder->getUrl($path, $arguments));
 }
Ejemplo n.º 16
0
 /**
  * {@inheritdoc}
  */
 protected function render(App\ResponseInterface $response)
 {
     $response->setRedirect($this->url);
     return $this;
 }
Ejemplo n.º 17
0
 /**
  * Validate and Match Blog Pages and modify request
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @return bool
  */
 public function match(\Magento\Framework\App\RequestInterface $request)
 {
     $_identifier = trim($request->getPathInfo(), '/');
     $pathInfo = explode('/', $_identifier);
     $blogRoute = $this->_url->getRoute();
     if ($pathInfo[0] != $blogRoute) {
         return;
     }
     unset($pathInfo[0]);
     switch ($this->_url->getPermalinkType()) {
         case Url::PERMALINK_TYPE_DEFAULT:
             foreach ($pathInfo as $i => $route) {
                 $pathInfo[$i] = $this->_url->getControllerName($route);
             }
             break;
         case Url::PERMALINK_TYPE_SHORT:
             if ($pathInfo[1] == $this->_url->getRoute(Url::CONTROLLER_SEARCH)) {
                 $pathInfo[1] = Url::CONTROLLER_SEARCH;
             } elseif (count($pathInfo) == 1) {
                 if ($this->_isArchiveIdentifier($pathInfo[1])) {
                     $pathInfo[2] = $pathInfo[1];
                     $pathInfo[1] = Url::CONTROLLER_ARCHIVE;
                 } elseif ($postId = $this->_getPostId($pathInfo[1])) {
                     $pathInfo[2] = $pathInfo[1];
                     $pathInfo[1] = Url::CONTROLLER_POST;
                 } elseif ($categoryId = $this->_getCategoryId($pathInfo[1])) {
                     $pathInfo[2] = $pathInfo[1];
                     $pathInfo[1] = Url::CONTROLLER_CATEGORY;
                 }
             }
             break;
     }
     $identifier = implode('/', $pathInfo);
     $condition = new \Magento\Framework\DataObject(['identifier' => $identifier, 'continue' => true]);
     $this->_eventManager->dispatch('magefan_blog_controller_router_match_before', ['router' => $this, 'condition' => $condition]);
     if ($condition->getRedirectUrl()) {
         $this->_response->setRedirect($condition->getRedirectUrl());
         $request->setDispatched(true);
         return $this->actionFactory->create('Magento\\Framework\\App\\Action\\Redirect', ['request' => $request]);
     }
     if (!$condition->getContinue()) {
         return null;
     }
     $identifier = $condition->getIdentifier();
     $success = false;
     $info = explode('/', $identifier);
     if (!$identifier) {
         $request->setModuleName('blog')->setControllerName('index')->setActionName('index');
         $success = true;
     } elseif (count($info) > 1) {
         $store = $this->_storeManager->getStore()->getId();
         switch ($info[0]) {
             case 'post':
                 if (!($postId = $this->_getPostId($info[1]))) {
                     return null;
                 }
                 $request->setModuleName('blog')->setControllerName('post')->setActionName('view')->setParam('id', $postId);
                 $success = true;
                 break;
             case 'category':
                 if (!($categoryId = $this->_getCategoryId($info[1]))) {
                     return null;
                 }
                 $request->setModuleName('blog')->setControllerName('category')->setActionName('view')->setParam('id', $categoryId);
                 $success = true;
                 break;
             case 'archive':
                 $request->setModuleName('blog')->setControllerName('archive')->setActionName('view')->setParam('date', $info[1]);
                 $success = true;
                 break;
             case 'search':
                 $request->setModuleName('blog')->setControllerName('search')->setActionName('index')->setParam('q', $info[1]);
                 $success = true;
                 break;
             case 'rss':
                 $request->setModuleName('blog')->setControllerName('rss')->setActionName(isset($info[1]) ? $info[1] : 'index');
                 $success = true;
                 break;
         }
     }
     if (!$success) {
         return null;
     }
     $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $_identifier);
     return $this->actionFactory->create('Magento\\Framework\\App\\Action\\Forward', ['request' => $request]);
 }
Ejemplo n.º 18
0
 /**
  * @param RequestInterface $request
  * @return \Magento\Framework\App\ActionInterface
  */
 public function match(RequestInterface $request)
 {
     $_brandHelper = $this->_brandHelper;
     if (!$this->dispatched) {
         $urlKey = trim($request->getPathInfo(), '/');
         $origUrlKey = $urlKey;
         /** @var Object $condition */
         $condition = new DataObject(['url_key' => $urlKey, 'continue' => true]);
         $this->eventManager->dispatch('ves_brand_controller_router_match_before', ['router' => $this, 'condition' => $condition]);
         $urlKey = $condition->getUrlKey();
         if ($condition->getRedirectUrl()) {
             $this->response->setRedirect($condition->getRedirectUrl());
             $request->setDispatched(true);
             return $this->actionFactory->create('Magento\\Framework\\App\\Action\\Redirect', ['request' => $request]);
         }
         if (!$condition->getContinue()) {
             return null;
         }
         $route = $_brandHelper->getConfig('general_settings/route');
         if ($urlKey == $route) {
             $request->setModuleName('vesbrand')->setControllerName('index')->setActionName('index');
             $request->setAlias(Url::REWRITE_REQUEST_PATH_ALIAS, $urlKey);
             $this->dispatched = true;
             return $this->actionFactory->create('Magento\\Framework\\App\\Action\\Forward', ['request' => $request]);
         }
         $url_prefix = $_brandHelper->getConfig('general_settings/url_prefix');
         $url_suffix = $_brandHelper->getConfig('general_settings/url_suffix');
         $identifiers = explode('/', $urlKey);
         //Check Group Url
         if (count($identifiers) == 2 && $identifiers[0] == $url_prefix && strpos($identifiers[1], $url_suffix) || trim($url_prefix) == '' && count($identifiers) == 1) {
             $brandUrl = '';
             if (trim($url_prefix) == '' && count($identifiers) == 1) {
                 $brandUrl = str_replace($url_suffix, '', $identifiers[0]);
             }
             if (count($identifiers) == 2) {
                 $brandUrl = str_replace($url_suffix, '', $identifiers[1]);
             }
             $group = $this->_groupCollection->getCollection()->addFieldToFilter('status', array('eq' => 1))->addFieldToFilter('url_key', array('eq' => $brandUrl))->getFirstItem();
             if ($group && $group->getId()) {
                 $request->setModuleName('vesbrand')->setControllerName('group')->setActionName('view')->setParam('group_id', $group->getId());
                 $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $origUrlKey);
                 $request->setDispatched(true);
                 $this->dispatched = true;
                 return $this->actionFactory->create('Magento\\Framework\\App\\Action\\Forward', ['request' => $request]);
             }
         }
         // Check Brand Url Key
         if (count($identifiers) == 2 && $identifiers[0] == $url_prefix && strpos($identifiers[1], $url_suffix) || trim($url_prefix) == '' && count($identifiers) == 1) {
             if (count($identifiers) == 2) {
                 $brandUrl = str_replace($url_suffix, '', $identifiers[1]);
             }
             if (trim($url_prefix) == '' && count($identifiers) == 1) {
                 $brandUrl = str_replace($url_suffix, '', $identifiers[0]);
             }
             $brand = $this->_brandCollection->getCollection()->addFieldToFilter('status', array('eq' => 1))->addFieldToFilter('url_key', array('eq' => $brandUrl))->getFirstItem();
             if ($brand && $brand->getId() && (in_array($this->storeManager->getStore()->getId(), $brand->getStoreId()) || in_array(0, $brand->getStoreId()))) {
                 $request->setModuleName('vesbrand')->setControllerName('brand')->setActionName('view')->setParam('brand_id', $brand->getId());
                 $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $origUrlKey);
                 $request->setDispatched(true);
                 $this->dispatched = true;
                 return $this->actionFactory->create('Magento\\Framework\\App\\Action\\Forward', ['request' => $request]);
             }
         }
     }
 }