File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
app/code/Magento/Bundle/Model/Product Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -665,7 +665,11 @@ protected function _prepareProduct(\Magento\Framework\DataObject $buyRequest, $p
665
665
$ skipSaleableCheck = $ this ->_catalogProduct ->getSkipSaleableCheck ();
666
666
$ _appendAllSelections = (bool )$ product ->getSkipCheckRequiredOption () || $ skipSaleableCheck ;
667
667
668
- $ options = $ buyRequest ->getBundleOption ();
668
+ if ($ buyRequest ->getBundleOptionsData ()) {
669
+ $ options = $ this ->getPreparedOptions ($ buyRequest ->getBundleOptionsData ());
670
+ } else {
671
+ $ options = $ buyRequest ->getBundleOption ();
672
+ }
669
673
if (is_array ($ options )) {
670
674
$ options = $ this ->recursiveIntval ($ options );
671
675
$ optionIds = array_keys ($ options );
@@ -1413,4 +1417,21 @@ protected function mergeSelectionsWithOptions($options, $selections)
1413
1417
1414
1418
return array_merge ([], ...$ selections );
1415
1419
}
1420
+
1421
+ /**
1422
+ * Get prepared options with selection ids
1423
+ *
1424
+ * @param array $options
1425
+ * @return array
1426
+ */
1427
+ private function getPreparedOptions (array $ options ): array
1428
+ {
1429
+ foreach ($ options as $ optionId => $ option ) {
1430
+ foreach ($ option as $ selectionId => $ optionQty ) {
1431
+ $ options [$ optionId ][$ selectionId ] = $ selectionId ;
1432
+ }
1433
+ }
1434
+
1435
+ return $ options ;
1436
+ }
1416
1437
}
You can’t perform that action at this time.
0 commit comments