File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
app/code/Magento/Catalog/Model Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -883,8 +883,8 @@ public function beforeSave()
883
883
884
884
$ this ->getTypeInstance ()->beforeSave ($ this );
885
885
886
- $ hasOptions = $ this ->getData ('has_options ' ) === "1 " ;
887
- $ hasRequiredOptions = $ this ->getData ('required_options ' ) === "1 " ;
886
+ $ hasOptions = $ this ->getData ('has_options ' ) === "1 " && $ this -> isProductHasOptions () ;
887
+ $ hasRequiredOptions = $ this ->getData ('required_options ' ) === "1 " && $ this -> isProductHasOptions () ;
888
888
889
889
/**
890
890
* $this->_canAffectOptions - set by type instance only
@@ -934,6 +934,21 @@ public function beforeSave()
934
934
parent ::beforeSave ();
935
935
}
936
936
937
+ /**
938
+ * Check based on options data
939
+ *
940
+ * @return bool
941
+ */
942
+ private function isProductHasOptions () : bool
943
+ {
944
+ if ($ this ->getData ('options ' ) === null ) {
945
+ $ result = true ;
946
+ } else {
947
+ $ result = is_array ($ this ->getData ('options ' )) && count ($ this ->getData ('options ' )) > 0 ;
948
+ }
949
+ return $ result ;
950
+ }
951
+
937
952
/**
938
953
* Check/set if options can be affected when saving product
939
954
*
You can’t perform that action at this time.
0 commit comments