Example #1
0
 /**
  * Render grid row
  *
  * @param \Magento\Framework\DataObject $row
  * @return string
  */
 public function render(\Magento\Framework\DataObject $row)
 {
     $imageUrl = $row->getImage() && $row->getImage() != 'no_selection' ? $this->escapeHtml($this->_productHelper->getImageUrl($row)) : '';
     return $this->_getValue($row) . '<input type="hidden" data-role="image-url" value="' . $imageUrl . '"/>';
 }
Example #2
0
 /**
  * Retrieve base image url
  *
  * @param ModelProduct|\Magento\Framework\DataObject $product
  * @return string|bool
  */
 public function getImageUrl($product)
 {
     $url = false;
     $attribute = $product->getResource()->getAttribute('image');
     if (!$product->getImage()) {
         $url = $this->_assetRepo->getUrl('Magento_Catalog::images/product/placeholder/image.jpg');
     } elseif ($attribute) {
         $url = $attribute->getFrontend()->getUrl($product);
     }
     return $url;
 }