In Magento 1 I've always used
$_product->getMediaGallery('images')
But in the source from Magento 2 I see
$productImage = $block->getImage($_product, $image);
echo $productImage->toHtml();
It's only getting the first product image. How do I get the second or third image (not only the base one)?
GetMediaGallery function doesn't exists?
$_product->getMediaGalleryImages() throws NULL in a var_dump
and
for getMediaGallery and getMediaGalleryEntries I get the same notice error:
Undefined property: Magento\Catalog\Model\Product\Interceptor::$getMediaGallery
Best Answer
create helper for example :
call and use inside your list.phtml : $_helperGallery = $this->helper('Ibnab\Common\Helper\Data'); now you can use with current called product inside for each (with you technique):
the complete source of course