scopeConfig = $scopeConfig; parent::__construct($context); } /** * Dispatch request * * @param \Magento\Framework\App\RequestInterface $request * @return \Magento\Framework\App\ResponseInterface * @throws \Magento\Framework\Exception\NotFoundException */ public function dispatch(RequestInterface $request) { $searchTerms = $this->scopeConfig->getValue( 'catalog/seo/search_terms', ScopeInterface::SCOPE_STORE ); if (!$searchTerms) { $this->_redirect('noroute'); $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true); } return parent::dispatch($request); } /** * @return \Magento\Framework\View\Result\Page */ public function execute() { /** @var \Magento\Framework\View\Result\Page $resultPage */ $resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE); return $resultPage; } }