@@ -315,24 +315,21 @@ public function prepareForCart()
315
315
public function getFormattedOptionValue ($ optionValue )
316
316
{
317
317
if ($ this ->_formattedOptionValue === null ) {
318
- if ($ optionValue !== 'null ' ) {
319
- $ value = $ this ->serializer ->unserialize ($ optionValue );
320
- if ($ value !== null ) {
321
- $ customOptionUrlParams = $ this ->getCustomOptionUrlParams ()
322
- ? $ this ->getCustomOptionUrlParams ()
323
- : [
324
- 'id ' => $ this ->getConfigurationItemOption ()->getId (),
325
- 'key ' => $ value ['secret_key ' ]
326
- ];
327
-
328
- $ value ['url ' ] = ['route ' => $ this ->_customOptionDownloadUrl , 'params ' => $ customOptionUrlParams ];
329
-
330
- $ this ->_formattedOptionValue = $ this ->_getOptionHtml ($ value );
331
- $ this ->getConfigurationItemOption ()->setValue ($ this ->serializer ->serialize ($ value ));
332
- return $ this ->_formattedOptionValue ;
333
- }
318
+ $ value = $ this ->serializer ->unserialize ($ optionValue );
319
+ if ($ value === null ) {
320
+ return $ optionValue ;
334
321
}
335
- return $ optionValue ;
322
+ $ customOptionUrlParams = $ this ->getCustomOptionUrlParams ()
323
+ ? $ this ->getCustomOptionUrlParams ()
324
+ : [
325
+ 'id ' => $ this ->getConfigurationItemOption ()->getId (),
326
+ 'key ' => $ value ['secret_key ' ]
327
+ ];
328
+
329
+ $ value ['url ' ] = ['route ' => $ this ->_customOptionDownloadUrl , 'params ' => $ customOptionUrlParams ];
330
+
331
+ $ this ->_formattedOptionValue = $ this ->_getOptionHtml ($ value );
332
+ $ this ->getConfigurationItemOption ()->setValue ($ this ->serializer ->serialize ($ value ));
336
333
}
337
334
return $ this ->_formattedOptionValue ;
338
335
}
@@ -403,15 +400,13 @@ public function getPrintableOptionValue($optionValue)
403
400
*/
404
401
public function getEditableOptionValue ($ optionValue )
405
402
{
406
- if ($ optionValue !== 'null ' ) {
407
- $ unserializedValue = $ this ->serializer ->unserialize ($ optionValue );
408
- if ($ unserializedValue !== null ) {
409
- return sprintf (
410
- '%s [%d] ' ,
411
- $ this ->_escaper ->escapeHtml ($ unserializedValue ['title ' ]),
412
- $ this ->getConfigurationItemOption ()->getId ()
413
- );
414
- }
403
+ $ unserializedValue = $ this ->serializer ->unserialize ($ optionValue );
404
+ if ($ unserializedValue !== null ) {
405
+ return sprintf (
406
+ '%s [%d] ' ,
407
+ $ this ->_escaper ->escapeHtml ($ unserializedValue ['title ' ]),
408
+ $ this ->getConfigurationItemOption ()->getId ()
409
+ );
415
410
}
416
411
return $ optionValue ;
417
412
}
@@ -433,11 +428,8 @@ public function parseOptionValue($optionValue, $productOptionValues)
433
428
if (preg_match ('/\[([0-9]+)\]/ ' , $ optionValue , $ matches )) {
434
429
$ confItemOptionId = $ matches [1 ];
435
430
$ option = $ this ->_itemOptionFactory ->create ()->load ($ confItemOptionId );
436
- if ($ option ->getValue () !== 'null ' ) {
437
- $ unserializedValue = $ this ->serializer ->unserialize ($ option ->getValue ());
438
- if ($ unserializedValue !== null ) {
439
- return $ option ->getValue ();
440
- }
431
+ if ($ this ->serializer ->unserialize ($ option ->getValue ()) !== null ) {
432
+ return $ option ->getValue ();
441
433
}
442
434
}
443
435
return null ;
@@ -451,11 +443,9 @@ public function parseOptionValue($optionValue, $productOptionValues)
451
443
*/
452
444
public function prepareOptionValueForRequest ($ optionValue )
453
445
{
454
- if ($ optionValue !== 'null ' ) {
455
- $ unserializedValue = $ this ->serializer ->unserialize ($ optionValue );
456
- if ($ unserializedValue !== null ) {
457
- return $ unserializedValue ;
458
- }
446
+ $ unserializedValue = $ this ->serializer ->unserialize ($ optionValue );
447
+ if ($ unserializedValue !== null ) {
448
+ return $ unserializedValue ;
459
449
}
460
450
return null ;
461
451
}
0 commit comments