File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
app/code/Magento/Bundle/Block/Catalog/Product/View/Type Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -185,6 +185,17 @@ public function getJsonConfig()
185185 if ($ configValue ) {
186186 $ defaultValues [$ optionId ] = $ configValue ;
187187 }
188+
189+ $ preConfiguredQtys = $ preConfiguredValues ->getData ("bundle_option_qty/ $ {optionId}" ) ?? [];
190+ $ selections = $ options [$ optionId ]['selections ' ];
191+ array_walk ($ selections , function (&$ selection , $ selectionId ) use ($ preConfiguredQtys ) {
192+ if (is_array ($ preConfiguredQtys ) && isset ($ preConfiguredQtys [$ selectionId ])) {
193+ $ selection ['qty ' ] = $ preConfiguredQtys [$ selectionId ];
194+ } else if ((int )$ preConfiguredQtys > 0 ) {
195+ $ selection ['qty ' ] = $ preConfiguredQtys ;
196+ }
197+ });
198+ $ options [$ optionId ]['selections ' ] = $ selections ;
188199 }
189200 $ position ++;
190201 }
Original file line number Diff line number Diff line change @@ -169,7 +169,9 @@ protected function _getSelectedOptions()
169169 */
170170 protected function assignSelection (\Magento \Bundle \Model \Option $ option , $ selectionId )
171171 {
172- if ($ selectionId && $ option ->getSelectionById ($ selectionId )) {
172+ if (is_array ($ selectionId )) {
173+ $ this ->_selectedOptions = $ selectionId ;
174+ } else if ($ selectionId && $ option ->getSelectionById ($ selectionId )) {
173175 $ this ->_selectedOptions = $ selectionId ;
174176 } elseif (!$ option ->getRequired ()) {
175177 $ this ->_selectedOptions = 'None ' ;
You can’t perform that action at this time.
0 commit comments