Magento Asked on October 2, 2021
Basically I want to show static content using a block on my category menu in Magento 2.3.5. I have created a category and set Display Mode as Static Block only, Anchor set to No and Added a block from Add CMS Block dropdown, but the issue is when I try to browse this category it shows
We can't find products matching the selection.
How to hide this message.
The message We can't find products matching the selection. comes from the file /magento/vendor/magento/module-catalog/view/frontend/templates/product/list.phtml
.
You need to override the list.phtml
file in your custom module or theme to hide the message.
Example:
<?php
/**
* Product list template
*
* @see MagentoCatalogBlockProductListProduct
*/
?>
<?php
$_productCollection = $block->getLoadedProductCollection();
$_helper = $this->helper(MagentoCatalogHelperOutput::class);
?>
<?php if (!$_productCollection->count()) :?>
// ---------------------- comment or remove the below code ------------------------------
<div class="message info empty"><div><?= $block->escapeHtml(__('We can't find products matching the selection.')) ?></div></div>
<?php else :?>
<?= $block->getToolbarHtml() ?>
<?= $block->getAdditionalHtml() ?>
....
....
I hope this helps!
Correct answer by Bhaumik Upadhyay on October 2, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP