Skip to content

Commit 28baf4c

Browse files
author
Sergey Shvets
committed
MAGETWO-63704: [Backport] - Scheduled Update removes all simple variations from Configurable product - for 2.1
1 parent f59024f commit 28baf4c

File tree

1 file changed

+25
-6
lines changed
  • app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations

1 file changed

+25
-6
lines changed

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

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -301,12 +301,8 @@ define([
301301
* Chose action for the form save button
302302
*/
303303
saveFormHandler: function() {
304-
this.source.data["product"]["configurable-matrix-serialized"] =
305-
JSON.stringify(this.source.data["configurable-matrix"]);
306-
delete this.source.data["configurable-matrix"];
307-
this.source.data["product"]["associated_product_ids_serialized"] =
308-
JSON.stringify(this.source.data["associated_product_ids"]);
309-
delete this.source.data["associated_product_ids"];
304+
this.serializeData();
305+
310306
if (this.checkForNewAttributes()) {
311307
this.formSaveParams = arguments;
312308
this.attributeSetHandlerModal().openModal();
@@ -315,6 +311,29 @@ define([
315311
}
316312
},
317313

314+
/**
315+
* Serialize data for specific form fields
316+
*
317+
* Get data from outdated fields, serialize it and produce new form fields.
318+
*
319+
* Outdated fields:
320+
* - configurable-matrix;
321+
* - associated_product_ids.
322+
*
323+
* New fields:
324+
* - configurable-matrix-serialized;
325+
* - associated_product_ids_serialized.
326+
*/
327+
serializeData: function () {
328+
this.source.data["product"]["configurable-matrix-serialized"] =
329+
JSON.stringify(this.source.data["configurable-matrix"]);
330+
delete this.source.data["configurable-matrix"];
331+
332+
this.source.data["product"]["associated_product_ids_serialized"] =
333+
JSON.stringify(this.source.data["associated_product_ids"]);
334+
delete this.source.data["associated_product_ids"];
335+
},
336+
318337
/**
319338
* Check for newly added attributes
320339
* @returns {Boolean}

0 commit comments

Comments
 (0)