Skip to content

Commit 865afba

Browse files
author
Denys Rul
committed
MAGETWO-57210: [github #6195, 4101] Gallery doesn't show all images added to configurable options
1 parent 27f620e commit 865afba

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -268,26 +268,26 @@ define([
268268
*/
269269
_changeProductImage: function () {
270270
var images,
271-
initialImages = $.extend(true, [], this.options.mediaGalleryInitial),
271+
initialImages = this.options.mediaGalleryInitial,
272272
galleryObject = $(this.options.mediaGallerySelector).data('gallery');
273273

274274
if (!galleryObject) {
275275
return;
276276
}
277277

278-
if (this.options.spConfig.images[this.simpleProduct]) {
279-
images = $.extend(true, [], this.options.spConfig.images[this.simpleProduct]);
280-
}
278+
images = this.options.spConfig.images[this.simpleProduct];
281279

282280
if (images) {
283-
images.forEach(function (img) {
284-
img.type = 'image';
285-
});
286-
287281
if (this.options.gallerySwitchStrategy === 'prepend') {
288282
images = images.concat(initialImages);
289283
}
290284

285+
images = $.extend(true, [], images);
286+
287+
images.forEach(function (img) {
288+
img.type = 'image';
289+
});
290+
291291
galleryObject.updateData(images);
292292
} else {
293293
galleryObject.updateData(initialImages);

0 commit comments

Comments
 (0)