Skip to content

Commit 46860a0

Browse files
author
Pniel (Pini) Cohen
authored
Merge pull request #77 from ankurvr/ankurvr-patch-no_selection
Handled 'no_selection' image url
2 parents abb3aae + b91940e commit 46860a0

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

Plugin/Catalog/Block/Product/ImageFactory.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ public function aroundCreate(CatalogImageFactory $catalogImageFactory, callable
138138
return $imageBlock;
139139
}
140140

141+
if ($imageBlock->getImageUrl() === 'no_selection') {
142+
return $imageBlock;
143+
}
144+
141145
if ($this->configuration->isEnabledLazyload()) {
142146
$useOldImageTheme = is_string($imageBlock->getCustomAttributes()) ? 'old_' : '';
143147
$imageBlock->setTemplate(

Plugin/Catalog/Model/Product/Image/UrlBuilder.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ public function aroundGetUrl(CatalogUrlBuilder $catalogUrlBuilder, callable $pro
117117
return $url;
118118
}
119119

120+
if ($url === 'no_selection') {
121+
return $url;
122+
}
123+
120124
if (class_exists('\Magento\Catalog\Model\Product\Image\ParamsBuilder')) {
121125
$this->imageParamsBuilder = $this->objectManager->get('\Magento\Catalog\Model\Product\Image\ParamsBuilder');
122126
} else {

Plugin/ImageHelper.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ public function aroundGetUrl(CatalogImageHelper $helper, \Closure $originalMetho
138138
return $originalMethod();
139139
}
140140

141+
if ($imageBlock->getImageUrl() === 'no_selection') {
142+
return $imageBlock;
143+
}
144+
141145
$imagePath = $this->imageFile ?: $this->product->getData($helper->getType());
142146

143147
$image = $this->imageFactory->build(sprintf('catalog/product%s', $imagePath), $originalMethod);

0 commit comments

Comments
 (0)