Magento: How to hide products that have no images

If you would like to hide products without images in your Magento store product list page, this is one way to do it. edit app/design/frontend/[YOUR CURRENT TEMPLATE]/[YOUR CURRENT THEME]/template/catalog/list.phtml (e.g. app/design/frontend/default/default/template/catalog/list.phtml)

Change :



$_productCollection = clone $this->getLoadedProductCollection(); $_productCollection->clear() ->addAttributeToFilter('image', array('neq' => 'no_selection')) ->load();

Since the collection we get from getLoadedProductCollection was already fetched from database, we cannot add attribute filters to it, that’s why it wouldn’t work without the clone. So we need to clone it then clear it. then add the attribute filter.

If you are not familiar with neq, neq means not equal.