diff --git a/Model/Api/OrderInfo.php b/Model/Api/OrderInfo.php index ccdfdb6..4497073 100644 --- a/Model/Api/OrderInfo.php +++ b/Model/Api/OrderInfo.php @@ -267,62 +267,28 @@ protected function getProductById($id) return $product; } - /** - * @param $product - * @return mixed - */ - public function doesProductHaveImage($product) - { - $image = false; - - if (!$product || !$product->getId()) { - return $image; - } - - $image = $product->getImage(); - - if (empty($image) || $image == 'no_selection') { - $image = $product->getSmallImage(); - } - - if (empty($image) || $image == 'no_selection') { - $image = $product->getThumbnail(); - } - - return (empty($image) || $image == 'no_selection') ? false : true; - } - /** * @param $product * @return bool */ public function getImageByProduct1($product) { - $image = false; - - $productHasImage = $this->doesProductHaveImage($product); - - if ($productHasImage) { - $mediaGalleryImages = $product->getMediaGalleryImages(); - - $image = $mediaGalleryImages->getFirstItem()->getUrl(); - } + $mediaGalleryImages = $product->getMediaGalleryImages(); + $image = $mediaGalleryImages->getFirstItem()->getUrl(); return $image; } + /** + * @param $product + * @return bool|string + */ public function getImageByProduct($product) { - $image = false; - - $productHasImage = $this->doesProductHaveImage($product); - - if ($productHasImage) { - $image = $this->image - ->init($product, 'product_page_image_large') - ->setImageFile($product->getImage()) - ->getUrl(); - } + $image = $this->image + ->init($product, 'product_page_image_large') + ->setImageFile($product->getImage()) + ->getUrl(); return $image; } diff --git a/composer.json b/composer.json index 8a931a6..cd44cbb 100644 --- a/composer.json +++ b/composer.json @@ -17,5 +17,5 @@ "OSL-3.0", "AFL-3.0" ], - "version": "1.0.7" + "version": "1.0.8" } diff --git a/etc/config.xml b/etc/config.xml index 69e8a69..0ee5ab5 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -5,7 +5,7 @@ 1 - + diff --git a/etc/module.xml b/etc/module.xml index 39f29d5..b4edc23 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -1,6 +1,6 @@ - +