Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,17 @@ public function getJsonConfig()
if ($configValue) {
$defaultValues[$optionId] = $configValue;
}

$preConfiguredQtys = $preConfiguredValues->getData("bundle_option_qty/${optionId}") ?? [];
$selections = $options[$optionId]['selections'];
array_walk($selections, function (&$selection, $selectionId) use ($preConfiguredQtys) {
if (is_array($preConfiguredQtys) && isset($preConfiguredQtys[$selectionId])) {
$selection['qty'] = $preConfiguredQtys[$selectionId];
} else if ((int)$preConfiguredQtys > 0) {
$selection['qty'] = $preConfiguredQtys;
}
});
$options[$optionId]['selections'] = $selections;
}
$position++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ protected function _getSelectedOptions()
*/
protected function assignSelection(\Magento\Bundle\Model\Option $option, $selectionId)
{
if ($selectionId && $option->getSelectionById($selectionId)) {
if (is_array($selectionId)) {
$this->_selectedOptions = $selectionId;
} else if ($selectionId && $option->getSelectionById($selectionId)) {
$this->_selectedOptions = $selectionId;
} elseif (!$option->getRequired()) {
$this->_selectedOptions = 'None';
Expand Down