magento 2 Infortis ultimo theme display category tree menu on the left of the search result page
-
23-02-2021 - |
题
I am using the Infortis ultimo theme, in the included feature, i was able to add the category tree menu on the left bar of each category page, but how can i add it to the search result page?
is this something i can find using template hint & add to the layout file in Magento_CatalogSearch/layout/catalogsearch_result_index.xml
?
the shortcode to add it to the CMS Page or Static Block is this, how do I use it to add to the search result page?
{{block class="Infortis\UltraMegamenu\Block\Navigation" template="categories.phtml" parent="X"
depth="X" block_name="X"}}
解决方案
I was able to make the category tree shows in the search result page by copying the catalogsearch_result_index.xml
layout file to the ultimo theme folder with the following content:
<?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 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
<!-- add category to left -->
<referenceContainer name="sidebar.main">
<block class="Infortis\UltraMegamenu\Block\Navigation" before="-" template="categories.phtml"/>
</referenceContainer>
</body>
</page>
Since I was not able to assign the "parent" "depth" and "block_name" values in the XML file above. I then duplicate the "categories.phtml" and create a new template called "categories_searchresult.phtml" and assign the value of "parent" "depth" and "block_name" directly into the template file. Finally, change the template path in the xml to the new one.