my etc/frontend/routes.xml is :

 <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">    <!--front name for the controller-->
        <module name="Tagalys_Tglssearch"/>

My controller paths are:





is my layout file name correct ?


     <?xml version="1.0"?>
     <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <referenceBlock name="catalogsearch.leftnav">
            <argument name="setTemplate" xsi:type="string">Tagalys_Tglssearch::tagalys_search/filter.phtml</argument>
  <referenceBlock name="product_searchlist_toolbar">
            <argument name="template" xsi:type="string">Tagalys_Tglssearch::tagalys_toolbar/toolbar.phtml</argument>

Because my custom block is not at all getting called

class ListProduct extends \Magento\Catalog\Block\Product\ListProduct

public function __construct(
    /*passing all Constructors parameters to the parent class */    
    \Magento\Catalog\Block\Product\Context $context,
    \Magento\Framework\Data\Helper\PostHelper $postDataHelper,
    \Magento\Catalog\Model\Layer\Resolver $layerResolver,
     CategoryRepositoryInterface $categoryRepository,
    \Magento\Framework\Url\Helper\Data $urlHelper,
    /*passing all Constructors parameters to the parent class */    

    \Tagalys\Tglssearch\Helper\Data $tglssearchHelper,
    \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $catalogResourceModelProductCollectionFactory,
    \Magento\Catalog\Model\Config $catalogConfig,
    \Magento\Store\Model\StoreManagerInterface $storeManager,
    array $data = []
) {
    $this->tglssearchHelper = $tglssearchHelper;
    $this->catalogResourceModelProductCollectionFactory = $catalogResourceModelProductCollectionFactory;
    $this->catalogConfig = $catalogConfig;
    $this->storeManager = $storeManager;

    //$this->tglssearchHelper = $tglssearchHelper;
protected function _getProductCollection()
         echo 'My block';
  • add complete catalogsearch_result_index.xml file for more debug Jun 23 '16 at 12:37
  • tats the completed code of the xml @Rakesh... wat did u ask?
    – Sushivam
    Jun 23 '16 at 12:44
  • you have to add whole file start with <?xml version="1.0"?> in above questions. Jun 23 '16 at 12:44
  • have updated @Rakesh
    – Sushivam
    Jun 23 '16 at 12:49

Your xml file is incorrect format, Your <page> node format is incorrect block with name product_searchlist_toolbar not available in magento 2. I have remove from below code, Remaining code are below you can set from below,

<?xml version="1.0"?>
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <referenceBlock name="catalogsearch.leftnav">
            <argument name="setTemplate" xsi:type="string">Tagalys_Tglssearch::tagalys_search/filter.phtml</argument>

  • and the remaining part of the block is it correct? and file name?
    – Sushivam
    Jun 23 '16 at 12:58
  • Remaining all is correct with filename Jun 23 '16 at 12:58
  • I have a doubt as to from where we use that 'index' from the layout file name...i was assuming 'routerfrontName_controllerActionName_controllerName'.xml... so it would be catalogsearch_catalogsearch_result.xml correct me if im wrong
    – Sushivam
    Jun 23 '16 at 13:04
  • Could you please explain the proper way of using, im still confused
    – Sushivam
    Jun 23 '16 at 13:04
  • catalogsearch_result_index.xml is the correct file, this file is used when search result is display in site. Jun 23 '16 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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