<?xml version="1.0"?>
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
    <route id="catalogsearch" frontName="catalogsearch">    
        <module name="Vendor_Module" before="Magento_CatalogSearch"/>


namespace Vendor\Module\Controller\Result;

use Magento\Framework\App\Action\Context;
use Magento\Catalog\Model\Session;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Search\Model\QueryFactory;
use Magento\Catalog\Model\Layer\Resolver;

class Index extends \Magento\CatalogSearch\Controller\Result\Index
   protected $tglssearchHelper;
   protected $resultPageFactory;
   public function __construct(
    Context $context,
    \Magento\Framework\View\Result\PageFactory $resultPageFactory

) {
     $this->resultPageFactory = $resultPageFactory;

public function execute()
{   //echo 'tag exe';die;
    $resultPage = $this->resultPageFactory->create();

    return $resultPage;


UPDATED view/frontend/layout: catalogsearch_result_index.xml

<referenceBlock name="catalogsearch.leftnav">
<action method="setTemplate">
    <argument name="template" xsi:type="string">Vendor_Module::layer/view.phtml</argument>


/catalogsearch/result/?q=wirel... i get blank screen.


2 Answers 2


I think the problem is that the search form is not submitting to your controller. The URL it submits to is given by the getResultUrl method of Magento\Search\Helper\Data. You will need to override this method to make it return the address of your controller, 'catalogsearch/catalogsearch/resultcontroller', instead of 'catalogsearch/result'. This is assuming your module has this route defined in etc/frontend/routes.xml. Also, I think the controller needs to be named Index for get requests to work, so maybe use something like Tagalys\Tglssearch\Controller\Result\Index for your controller class and then register a route with name 'tglssearch' so that your endpoint is 'tglssearch/result'.

  • Hi Aaron, i have updated the controller, layout and helper method--getResultUrl in my custom, i still get catalogsearc/result...could you check updated answer
    – Sushivam
    Jul 2, 2016 at 17:26
  • Since creating a preference in di.xml isn't working, you could try to either 1) change the template file used by the 'top.search' block to a copy of Magento_Search::form.mini.phtml where the helper specified on line 12 is changed, 2) make a plugin for Magento\Search\Helper\Data with an 'afterGetResultUrl' method that will replace 'catalogsearch/result' in the returned string with 'tglssearch/result'. Jul 3, 2016 at 0:17
  • i tried with plugin instead of preference and changed the method to aftergetResultUrl()... errors seems to be gone.. but i get blank screen in home page with 'Search' keyword from form.mini...could you please see the updated code..
    – Sushivam
    Jul 3, 2016 at 2:29
  • Ok here is the updated answer...i copied form.mini.htmla nd deleted the original one as of no temporary...when i try to hit my controller url manually i get again home page withut search box on top righht...is deleting the core file suggested?
    – Sushivam
    Jul 3, 2016 at 2:49
  • Aaron any update on the same
    – Sushivam
    Jul 3, 2016 at 14:00

Try this


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.