4

i have followed the below link in order to get check if our custom layout xml file is loaded or not using the event: layout_generate_blocks_after

In the log file i just get:

2016-06-29T11:07:40+00:00 INFO (6):

 <layout/>

which should actually load my custom layout file : catalogsearch_catalogsearch_resultcontroller.xml

Could any1 please help why my layout file is not loading.

UPDATED: LAYOUT file catalogsearch_catalogsearch_resultcontroller.xml

controller path:

  • Vendor\Module\Controller\Catalog

  • Vendor\Module\Controller\CatalogSearch

  • Vendor\Module\Controller\CatalogSearch\Result.php

  • Vendor\Module\Controller\CatalogSearch\ResultController.php

\Vendor\Module\view\frontend\layout\catalogsearch_catalogsearch_resultcontroller.xml

<?xml version="1.0"?>
   <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
     <referenceBlock name="catalogsearch.leftnav"><arguments>
        <argument name="setTemplate" xsi:type="string">Vendor\Module::search/filter.phtml</argument>
        </arguments>
    </referenceBlock>

    <referenceBlock name="product_searchlist_toolbar">
        <arguments>
            <argument name="template" xsi:type="string">Vendor\Module::toolbar/toolbar.phtml</argument>
        </arguments>
     </referenceBlock>  

</body>

Above xml was replicated from 1x code which was as :

<?xml version="1.0"?>
<layout version="0.1.0">
 <catalogsearch_result_index>        
    <reference name="catalogsearch.leftnav">
        <action method="setTemplate">
            <setTemplate>/filter.phtml</setTemplate>
        </action>
    </reference>
      <reference name="content">
        <reference type="catalogsearch/result" name="search.result">
            <reference name="search_result_list">
                <reference name="product_list_toolbar">
                    <action method="setTemplate">
                        <template>toolbar.phtml</template>
                    </action>
                 </reference>
            </reference>
        </reference>
    </reference>
</catalogsearch_result_index>
 </layout>

system.log :

Cache file with merged layout: LAYOUT_frontend_STORE1_3d41d8cd98f00b204e9800998ecf8427e and handles : Please correct the XML data and try again.  [] []
4
  • 1
    Could you please post the code of your layout file ? Commented Jun 29, 2016 at 11:18
  • i have updated the layout file
    – Sushivam
    Commented Jun 29, 2016 at 11:35
  • layout ending tag is already there, i just forgot to give tab while adding question. and its magento1x code which i had replicated to magento2x layout file where the issue is
    – Sushivam
    Commented Jun 29, 2016 at 11:42
  • See my updated answer Commented Jun 29, 2016 at 11:45

1 Answer 1

0

It is because your file is not properly named.

It should be catalogsearch_result_index.xml instead of catalogsearch_catalogsearch_resultcontroller.xml

7
  • thats the magento1x xml file, which i forgot to tab while adding question...</layout> is already there.
    – Sushivam
    Commented Jun 29, 2016 at 11:39
  • But i dont have result/index in my custom module... i have the controller path as shown... should i still give catalogsearch_result_index.xml name instead, with just content replaced
    – Sushivam
    Commented Jun 29, 2016 at 11:51
  • i followed... routerfrontname_controlleraction_controllername.xml for naming the layout of my custom xml... is it rite? or should i use the default magentos catalogsearch_result_index
    – Sushivam
    Commented Jun 29, 2016 at 11:57
  • please see my system .log says in my updated answer
    – Sushivam
    Commented Jun 29, 2016 at 11:58
  • 1
    Did you ever get an answer to this? Commented Aug 22, 2016 at 10:08

Your Answer

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

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