문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

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

This should work.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top