Example #1
0
 /**
  * Retrieve small image url
  *
  * @param ModelProduct|\Magento\Framework\DataObject $product
  * @return string|bool
  */
 public function getSmallImageUrl($product)
 {
     $url = false;
     $attribute = $product->getResource()->getAttribute('small_image');
     if (!$product->getSmallImage()) {
         $url = $this->_assetRepo->getUrl('Magento_Catalog::images/product/placeholder/small_image.jpg');
     } elseif ($attribute) {
         $url = $attribute->getFrontend()->getUrl($product);
     }
     return $url;
 }