Skip to content

Commit

Permalink
Merge pull request #1291 from mailchimp/Issue1288-2.3
Browse files Browse the repository at this point in the history
closes #1288 for magento 2.3
  • Loading branch information
gonzaloebiz authored Sep 7, 2021
2 parents 9b280e5 + 9445f98 commit f259255
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions Model/Api/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"] = "";
Expand Down

0 comments on commit f259255

Please sign in to comment.