Skip to content

Commit

Permalink
closes #1288 for magento 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzaloebiz committed Sep 7, 2021
1 parent 648a199 commit 691f6c9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Model/Api/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -379,14 +379,14 @@ protected function _buildProductData(
$data["url"] = $product->getProductUrl();
$data["image_url"] = '';
if ($product->getImage() && $product->getImage()!='no_selection') {
$filePath = 'catalog/product'.$product->getImage();
$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();
$filePath = 'catalog/product'.ltrim($parent->getImage(), '/');
$data["image_url"] = $this->_helper->getBaserUrl($magentoStoreId, \Magento\Framework\UrlInterface::URL_TYPE_MEDIA).$filePath;
}
}
Expand Down

0 comments on commit 691f6c9

Please sign in to comment.