How do i hide products on the home page only that have no image
-
30-09-2020 - |
Question
I am looking for a way to hide all products that have no images on the home page only, whilst i do have image place overs setup with my logo, it just does not look right. I use a data content provider where products get imported on a daily basis and when new products are imported it takes some time for the data and images to show.
La solution
As option, use observer for event controller_action_layout_load_before. In observer check controller and route names like this
if(Mage::app()->getRequest()->getControllerName()=='page' && Mage::app()->getRequest()->getRouteName()='cms')
and after filter collection
$collection->addAttributeToFilter('small_image', array('neq' => "no_selection"));
Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange