File tree Expand file tree Collapse file tree 3 files changed +33
-3
lines changed
Catalog/view/adminhtml/web/js
Controller/Adminhtml/Product/Attribute/Plugin Expand file tree Collapse file tree 3 files changed +33
-3
lines changed Original file line number Diff line number Diff line change @@ -182,18 +182,17 @@ define([
182
182
}
183
183
editForm . on ( 'submit' , function ( ) {
184
184
editForm
185
- . find ( 'input[name^="option"]' )
185
+ . find ( '#manage-options-panel input[name^="option"]' )
186
186
. each ( function ( ) {
187
187
optionsValues . push ( this . name + '=' + jQuery ( this ) . val ( ) ) ;
188
- this . closest ( 'tr' ) . hide ( )
189
188
} ) ;
190
189
jQuery ( '<input>' )
191
190
. attr ( {
192
191
type : 'hidden' ,
193
192
name : 'serialized_options'
194
193
} )
195
194
. val ( JSON . stringify ( optionsValues ) )
196
- . prependTo ( '#edit_form' ) ;
195
+ . prependTo ( editForm ) ;
197
196
optionPanel . find ( 'table' )
198
197
. replaceWith ( jQuery ( '<div>' ) . text ( jQuery . mage . __ ( 'Sending attribute values as package.' ) ) ) ;
199
198
} ) ;
Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ class Save
24
24
public function beforeDispatch (Attribute \Save $ subject , RequestInterface $ request )
25
25
{
26
26
$ data = $ request ->getPostValue ();
27
+ $ data ['serialized_options ' ] = $ data ['serialized_swatch_values ' ];
28
+ unset($ data ['serialized_swatch_values ' ]);
27
29
if (isset ($ data ['frontend_input ' ])) {
28
30
switch ($ data ['frontend_input ' ]) {
29
31
case 'swatch_visual ' :
Original file line number Diff line number Diff line change @@ -414,6 +414,7 @@ define([
414
414
} ;
415
415
416
416
$ ( function ( ) {
417
+ var editForm = $ ( '#edit_form' ) ;
417
418
$ ( '#frontend_input' ) . bind ( 'change' , function ( ) {
418
419
swatchProductAttributes . bindAttributeInputType ( ) ;
419
420
} ) ;
@@ -427,6 +428,34 @@ define([
427
428
$ ( '.attribute-popup .collapse, [data-role="advanced_fieldset-content"]' )
428
429
. collapsable ( )
429
430
. collapse ( 'hide' ) ;
431
+
432
+ editForm . on ( 'submit' , function ( ) {
433
+ var activePanel ,
434
+ swatchValues = [ ] ,
435
+ swatchVisualPanel = $ ( '#swatch-visual-options-panel' ) ,
436
+ swatchTextPanel = $ ( '#swatch-text-options-panel' ) ;
437
+
438
+ activePanel = swatchTextPanel . is ( ":visible" ) ? swatchTextPanel : swatchVisualPanel ;
439
+
440
+ activePanel
441
+ . find ( 'table input' )
442
+ . each ( function ( ) {
443
+ swatchValues . push ( this . name + '=' + $ ( this ) . val ( ) ) ;
444
+ } ) ;
445
+
446
+ $ ( '<input>' )
447
+ . attr ( {
448
+ type : 'hidden' ,
449
+ name : 'serialized_swatch_values'
450
+ } )
451
+ . val ( JSON . stringify ( swatchValues ) )
452
+ . prependTo ( editForm ) ;
453
+
454
+ [ swatchVisualPanel , swatchTextPanel ] . forEach ( function ( el ) {
455
+ $ ( el ) . find ( 'table' )
456
+ . replaceWith ( $ ( '<div>' ) . text ( $ . mage . __ ( 'Sending swatch values as package.' ) ) ) ;
457
+ } ) ;
458
+ } ) ;
430
459
} ) ;
431
460
432
461
window . saveAttributeInNewSet = swatchProductAttributes . saveAttributeInNewSet ;
You can’t perform that action at this time.
0 commit comments