Skip to content

Commit 00b32bd

Browse files
committed
MAGETWO-60306: There is no ability to change price/image for Configurable product using "Edit Configuration"
- MAGETWO-55791: Fast Display and Generation of Product Variations for Configurable Products 2.0
1 parent 6b6a63f commit 00b32bd

File tree

1 file changed

+19
-15
lines changed
  • app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations

1 file changed

+19
-15
lines changed

app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -323,35 +323,24 @@ define([
323323
*/
324324
prepareVariations: function () {
325325
var mappedVariations = {},
326-
configurations = {};
326+
configurations = {},
327+
tempVariation = {};
327328

328329
this.associatedProducts = _.intersection(this.variations.pluck('productId'), this.associatedProducts);
329330

330331
_.each(this.variations, function (variation) {
331332
var attributes;
332333

333-
if (variation.productId) {
334-
configurations[variation.productId] = {
335-
'status': variation.status || '1'
336-
};
337-
338-
if (this.associatedProducts.indexOf(variation.productId) === -1) {
339-
this.associatedProducts.push(variation.productId);
340-
}
341-
342-
return;
343-
}
344-
345334
attributes = _.reduce(variation.options, function (memo, option) {
346335
var attribute = {};
347336

348337
attribute[option['attribute_code']] = option.value;
349338

350339
return _.extend(memo, attribute);
351340
}, {});
352-
353341
this.generateImageGallery(variation);
354-
mappedVariations[this.getVariationKey(variation.options)] = {
342+
343+
tempVariation = {
355344
'image': variation.image || '',
356345
'media_gallery': variation['media_gallery'] || {},
357346
'name': variation.name || variation.sku,
@@ -364,6 +353,21 @@ define([
364353
'qty': variation.quantity || null
365354
}
366355
};
356+
357+
if (variation.productId) {
358+
configurations[variation.productId] = tempVariation;
359+
360+
if (this.associatedProducts.indexOf(variation.productId) === -1) {
361+
this.associatedProducts.push(variation.productId);
362+
}
363+
_.each(variation.imageTypes, function (imageFile, key) {
364+
configurations[variation.productId][key] = imageFile;
365+
}, this);
366+
367+
return;
368+
}
369+
370+
mappedVariations[this.getVariationKey(variation.options)] = tempVariation;
367371
_.each(variation.imageTypes, function (imageFile, key) {
368372
mappedVariations[this.getVariationKey(variation.options)][key] = imageFile;
369373
}, this);

0 commit comments

Comments
 (0)