File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed
app/code/Magento/Catalog/Model/Product/Option Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -59,14 +59,25 @@ public function execute($entity, $arguments = [])
59
59
}
60
60
if ($ options ) {
61
61
$ hasChangedSku = ($ entity ->getOrigData ('sku ' ) !== null && $ entity ->dataHasChangedFor ('sku ' ));
62
- foreach ($ options as $ option ) {
63
- if ($ hasChangedSku && $ option ->hasData ('product_sku ' )) {
64
- $ option ->setProductSku ($ entity ->getSku ());
65
- }
66
- $ this ->optionRepository ->save ($ option );
67
- }
62
+ $ this ->processOptionsSaving ($ options , $ hasChangedSku , $ entity ->getSku ());
68
63
}
69
64
70
65
return $ entity ;
71
66
}
67
+
68
+ /**
69
+ * Save custom options
70
+ *
71
+ * @param array $options
72
+ * @param bool $hasChangedSku
73
+ * @param string $newSku
74
+ */
75
+ private function processOptionsSaving ($ options , $ hasChangedSku , $ newSku ) {
76
+ foreach ($ options as $ option ) {
77
+ if ($ hasChangedSku && $ option ->hasData ('product_sku ' )) {
78
+ $ option ->setProductSku ($ newSku );
79
+ }
80
+ $ this ->optionRepository ->save ($ option );
81
+ }
82
+ }
72
83
}
You can’t perform that action at this time.
0 commit comments