예제 #1
0
 public function testGetImageUrl()
 {
     /** @var $product \Magento\Catalog\Model\Product */
     $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Catalog\\Model\\Product');
     $this->assertStringEndsWith('placeholder/image.jpg', $this->_helper->getImageUrl($product));
     $product->setImage('test_image.png');
     $this->assertStringEndsWith('/test_image.png', $this->_helper->getImageUrl($product));
 }
예제 #2
0
 /**
  * Set current attribute to entry (for specified product)
  *
  * @param \Magento\Catalog\Model\Product $product
  * @param \Magento\Framework\Gdata\Gshopping\Entry $entry
  * @return \Magento\Framework\Gdata\Gshopping\Entry
  */
 public function convertAttribute($product, $entry)
 {
     $url = $this->_catalogProduct->getImageUrl($product);
     if ($product->getImage() && $product->getImage() != 'no_selection' && $url) {
         $this->_setAttribute($entry, 'image_link', self::ATTRIBUTE_TYPE_URL, $url);
     }
     return $entry;
 }
예제 #3
0
파일: Id.php 프로젝트: tingyeeh/magento2
 /**
  * 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 . '"/>';
 }