diff --git a/Model/Api/Product.php b/Model/Api/Product.php index ff23f95c..879d1000 100644 --- a/Model/Api/Product.php +++ b/Model/Api/Product.php @@ -393,21 +393,15 @@ protected function _buildProductData( $data["url"] = $product->getProductUrl(); $data["image_url"] = ''; if ($product->getImage() && $product->getImage()!='no_selection') { - $filePath = 'catalog/product'.$product->getImage(); - $data["image_url"] = $this->_helper->getBaserUrl( - $magentoStoreId, - \Magento\Framework\UrlInterface::URL_TYPE_MEDIA - ).$filePath; + $filePath = 'catalog/product/'.ltrim($product->getImage(), '/'); + $data["image_url"] = $this->_helper->getBaserUrl($magentoStoreId, \Magento\Framework\UrlInterface::URL_TYPE_MEDIA).$filePath; } elseif ($this->_parentImage) { $data['image_url'] = $this->_parentImage; } else { $parent = $this->_getParent($product->getId(), $magentoStoreId); if ($parent && $parent->getImage() && $parent->getImage()!='no_selection') { - $filePath = 'catalog/product'.$parent->getImage(); - $data["image_url"] = $this->_helper->getBaserUrl( - $magentoStoreId, - \Magento\Framework\UrlInterface::URL_TYPE_MEDIA - ).$filePath; + $filePath = 'catalog/product'.ltrim($parent->getImage(), '/'); + $data["image_url"] = $this->_helper->getBaserUrl($magentoStoreId, \Magento\Framework\UrlInterface::URL_TYPE_MEDIA).$filePath; } } $data["published_at_foreign"] = "";