Pergunta

The following code is from the related.phtml file and I believe this is what needs to be modified to filter out products without images:

<?php if(!$_item->isComposite() && $_item->isSaleable()): ?>

How do I extend the above code to show products with images only in the related products block?

Foi útil?

Solução

If you only care about the thumbnail image, which is the one shown in the default template then then try checking if the $_item has that data set.

$_item->hasData('thumbnail')

One note is that currently in the template it only wraps the checkbox with the check that you mentions so you would still display the product even if you add this check, but the user could not add them to the cart.

Outras dicas

<?php if(!$_item->isComposite() && $_item->isSaleable() && $_item->getProduct()->hasImage()): ?>

This should work.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a magento.stackexchange
scroll top