![]() 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/vendor/magento/module-catalog-search/Controller/Advanced/ |
<?php /** * * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\CatalogSearch\Controller\Advanced; use Magento\Framework\App\Action\HttpGetActionInterface; use Magento\CatalogSearch\Model\Advanced as ModelAdvanced; use Magento\Framework\App\Action\Context; use Magento\Framework\App\Action\HttpPostActionInterface; use Magento\Framework\UrlFactory; /** * Advanced search result. */ class Result extends \Magento\Framework\App\Action\Action implements HttpGetActionInterface, HttpPostActionInterface { /** * No results default handle. */ const DEFAULT_NO_RESULT_HANDLE = 'catalogsearch_advanced_result_noresults'; /** * Url factory * * @var UrlFactory */ protected $_urlFactory; /** * Catalog search advanced * * @var ModelAdvanced */ protected $_catalogSearchAdvanced; /** * Construct * * @param Context $context * @param ModelAdvanced $catalogSearchAdvanced * @param UrlFactory $urlFactory */ public function __construct( Context $context, ModelAdvanced $catalogSearchAdvanced, UrlFactory $urlFactory ) { parent::__construct($context); $this->_catalogSearchAdvanced = $catalogSearchAdvanced; $this->_urlFactory = $urlFactory; } /** * @inheritdoc */ public function execute() { try { $this->_catalogSearchAdvanced->addFilters($this->getRequest()->getQueryValue()); $this->_view->getPage()->initLayout(); $handles = $this->_view->getLayout()->getUpdate()->getHandles(); $handles[] = static::DEFAULT_NO_RESULT_HANDLE; $this->_view->loadLayout($handles); $this->_view->renderLayout(); } catch (\Magento\Framework\Exception\LocalizedException $e) { $this->messageManager->addError($e->getMessage()); $defaultUrl = $this->_urlFactory->create() ->addQueryParams($this->getRequest()->getQueryValue()) ->getUrl('*/*/'); $resultRedirect = $this->resultRedirectFactory->create(); $resultRedirect->setUrl($this->_redirect->error($defaultUrl)); return $resultRedirect; } } }