I want to see search results in list mode by default in desktop, and see it on grid mode on mobile.
What should I do?
Right now I edited catalog search list.phtml
to show list mode by default on search result page but on mobile, I see list mode too. I want to see grid mode on mobile.
Update from comment:
if ($block->getMode() == 'grid') {
$viewMode = 'list';
$image = 'category_page_list';
$showDescription = false;
$templateType =
\Magento\Catalog\Block\Product\ReviewRendererInterface::SHORT_VIEW;
} else {
$viewMode = 'grid';
$image = 'category_page_grid';
$showDescription = true;
$templateType =
\Magento\Catalog\Block\Product\ReviewRendererInterface::FULL_VIEW;
}
but it works on any device, can not seperate them for devices