@@ -383,12 +383,7 @@ define([
383
383
* Chose action for the form save button
384
384
*/
385
385
saveFormHandler : function ( ) {
386
- this . source . data [ 'configurable-matrix-serialized' ] =
387
- JSON . stringify ( this . source . data [ 'configurable-matrix' ] ) ;
388
- delete this . source . data [ 'configurable-matrix' ] ;
389
- this . source . data [ 'associated_product_ids_serialized' ] =
390
- JSON . stringify ( this . source . data [ 'associated_product_ids' ] ) ;
391
- delete this . source . data [ 'associated_product_ids' ] ;
386
+ this . serializeData ( ) ;
392
387
393
388
if ( this . checkForNewAttributes ( ) ) {
394
389
this . formSaveParams = arguments ;
@@ -398,6 +393,31 @@ define([
398
393
}
399
394
} ,
400
395
396
+ /**
397
+ * Serialize data for specific form fields
398
+ *
399
+ * Get data from outdated fields, serialize it and produce new form fields.
400
+ *
401
+ * Outdated fields:
402
+ * - configurable-matrix;
403
+ * - associated_product_ids.
404
+ *
405
+ * New fields:
406
+ * - configurable-matrix-serialized;
407
+ * - associated_product_ids_serialized.
408
+ */
409
+ serializeData : function ( ) {
410
+ this . source . data [ 'configurable-matrix-serialized' ] =
411
+ JSON . stringify ( this . source . data [ 'configurable-matrix' ] ) ;
412
+
413
+ delete this . source . data [ 'configurable-matrix' ] ;
414
+
415
+ this . source . data [ 'associated_product_ids_serialized' ] =
416
+ JSON . stringify ( this . source . data [ 'associated_product_ids' ] ) ;
417
+
418
+ delete this . source . data [ 'associated_product_ids' ] ;
419
+ } ,
420
+
401
421
/**
402
422
* Check for newly added attributes
403
423
* @returns {Boolean }
0 commit comments