@@ -301,12 +301,8 @@ define([
301
301
* Chose action for the form save button
302
302
*/
303
303
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
+
310
306
if ( this . checkForNewAttributes ( ) ) {
311
307
this . formSaveParams = arguments ;
312
308
this . attributeSetHandlerModal ( ) . openModal ( ) ;
@@ -315,6 +311,29 @@ define([
315
311
}
316
312
} ,
317
313
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
+
318
337
/**
319
338
* Check for newly added attributes
320
339
* @returns {Boolean }
0 commit comments