Beispiel #1
0
 /**
  * Returns the absolute product image url of the primary image.
  *
  * @param Product|ProductCore $product the product model.
  * @param Link|LinkCore $link optional link instance to use instead of the one in current context.
  * @return string the url or empty string if could not be generated.
  */
 public function getProductImageUrl($product, $link = null)
 {
     if (is_null($link)) {
         $link = Context::getContext()->link;
     }
     $image_id = $product->getCoverWs();
     if ((int) $image_id > 0) {
         $image_type = $this->chooseOptimalImageType();
         if (!empty($image_type)) {
             return $link->getImageLink($product->link_rewrite, $product->id . '-' . $image_id, $image_type);
         }
     }
     return '';
 }