Skip to content

Commit 4e190ef

Browse files
Fixed magento text swatch switches product image even if attribute feature is disabled
1 parent 1e29a6c commit 4e190ef

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

app/code/Magento/Swatches/Block/Product/Renderer/Configurable.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ public function getJsonSwatchConfig()
179179
$attributeDataArray
180180
);
181181
}
182+
if (isset($attributeDataArray['additional_data'])) {
183+
$config[$attributeId]['additional_data'] = $attributeDataArray['additional_data'];
184+
}
182185
}
183186

184187
return $this->jsonEncoder->encode($config);

app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,11 @@ define([
785785
$widget.options.jsonConfig.optionPrices
786786
]);
787787

788-
$widget._loadMedia(eventName);
788+
var checkAdditionalData = JSON.parse(this.options.jsonSwatchConfig[attributeId]['additional_data']);
789+
790+
if (1 == checkAdditionalData['update_product_preview_image']) {
791+
$widget._loadMedia(eventName);
792+
}
789793
$input.trigger('change');
790794
},
791795

0 commit comments

Comments
 (0)