Magento – Magento 2.0 Default Product Search Results To A List View

magento-2.0magento2search

How do I display product search results in a single column? Essentially I want to default it to a list view all the time. Would I need to make a controller to append the query variable to the URL?

Sample

Best Answer

To set default list mode for search result page, you can copy catalogsearch_result_index.xml

from:

vendor\magento\module-catalog-search\view\frontend\layout 

to:

app\design\frontend\Your_Vendor_Name\Your_Theme_Name\Magento_CatalogSearch\layout

add this code:

<arguments>
    <argument name="_current_grid_mode" xsi:type="string">list</argument>
</arguments>

into block name: product_list_toolbar

Related Topic