Skip to content

Commit 0af8e32

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-69501' into 2.1.8-develop-pr20
2 parents 329a02f + 7f7873e commit 0af8e32

File tree

4 files changed

+474
-3
lines changed

4 files changed

+474
-3
lines changed

app/code/Magento/Swatches/Helper/Data.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,14 @@ private function getAllSizeImages(ModelProduct $product, $imageFile)
346346
*/
347347
private function getSwatchAttributes(Product $product)
348348
{
349-
$swatchAttributes = $this->swatchAttributesProvider->provide($product);
350-
return $swatchAttributes;
349+
$attributes = $this->swatchAttributesProvider->provide($product) ?: [];
350+
foreach ($attributes as $attribute) {
351+
if (!$attribute->hasData(Swatch::SWATCH_INPUT_TYPE_KEY)) {
352+
$this->populateAdditionalDataEavAttribute($attribute);
353+
}
354+
}
355+
356+
return $attributes;
351357
}
352358

353359
/**

app/code/Magento/Swatches/Test/Unit/Helper/DataTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,10 @@ public function testGetSwatchAttributesAsArray($optionsArray, $attributeData, $e
552552
$storeMock->method('getId')->willReturn($storeId);
553553
$this->storeManagerMock->method('getStore')->willReturn($storeMock);
554554

555-
$this->attributeMock->method('getData')->with('')->willReturn($attributeData);
555+
$this->attributeMock
556+
->method('getData')
557+
->withConsecutive(['additional_data'], [''])
558+
->will($this->onConsecutiveCalls('', $attributeData));
556559

557560
$sourceMock = $this->getMock(
558561
\Magento\Eav\Model\Entity\Attribute\Source\AbstractSource::class,

0 commit comments

Comments
 (0)