Skip to content

Commit

Permalink
#4942: bundled products now retain customer selections when editing f…
Browse files Browse the repository at this point in the history
…rom cart
  • Loading branch information
JosephMaxwell authored and gelanivishal committed Oct 11, 2018
1 parent e210b70 commit 53f5942
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 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 @@ -193,6 +193,18 @@ public function getJsonConfig()
$options[$optionId]['selections'][$configValue]['qty'] = $configQty;
}
}


$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

0 comments on commit 53f5942

Please sign in to comment.