|
26 | 26 | */
|
27 | 27 | class Data extends \Magento\Framework\App\Helper\AbstractHelper
|
28 | 28 | {
|
29 |
| - /** |
30 |
| - * When we init media gallery empty image types contain this value. |
31 |
| - */ |
32 |
| - const EMPTY_IMAGE_VALUE = 'no_selection'; |
33 |
| - |
34 | 29 | /**
|
35 | 30 | * Default store ID
|
36 | 31 | */
|
@@ -380,11 +375,11 @@ function ($value) {
|
380 | 375 | */
|
381 | 376 | public function getProductMediaGallery (Product $product)
|
382 | 377 | {
|
383 |
| - if (!in_array($product->getData('image'), [null, self::EMPTY_IMAGE_VALUE], true)) { |
| 378 | + if (!in_array($product->getData('image'), [null, 'no_selection'], true)) { |
384 | 379 | $baseImage = $product->getData('image');
|
385 | 380 | } else {
|
386 | 381 | $productMediaAttributes = array_filter($product->getMediaAttributeValues(), function ($value) {
|
387 |
| - return $value !== self::EMPTY_IMAGE_VALUE && $value !== null; |
| 382 | + return $value !== 'no_selection' && $value !== null; |
388 | 383 | });
|
389 | 384 | foreach ($productMediaAttributes as $attributeCode => $value) {
|
390 | 385 | if ($attributeCode !== 'swatch_image') {
|
@@ -645,7 +640,7 @@ private function loadFirstVariation($attributeCode, ModelProduct $configurablePr
|
645 | 640 | $usedProducts = $configurableProduct->getTypeInstance()->getUsedProducts($configurableProduct);
|
646 | 641 |
|
647 | 642 | foreach ($usedProducts as $simpleProduct) {
|
648 |
| - if (!in_array($simpleProduct->getData($attributeCode), [null, self::EMPTY_IMAGE_VALUE], true) |
| 643 | + if (!in_array($simpleProduct->getData($attributeCode), [null, 'no_selection'], true) |
649 | 644 | && !array_diff_assoc($requiredAttributes, $simpleProduct->getData())
|
650 | 645 | ) {
|
651 | 646 | return $simpleProduct;
|
|
0 commit comments