Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 53f5942

Browse files
JosephMaxwellgelanivishal
authored andcommitted
#4942: bundled products now retain customer selections when editing from cart
1 parent e210b70 commit 53f5942

File tree

1 file changed

+12
-0
lines changed
  • app/code/Magento/Bundle/Block/Catalog/Product/View/Type

1 file changed

+12
-0
lines changed

app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,18 @@ public function getJsonConfig()
193193
$options[$optionId]['selections'][$configValue]['qty'] = $configQty;
194194
}
195195
}
196+
197+
198+
$preConfiguredQtys = $preConfiguredValues->getData("bundle_option_qty/${optionId}") ?? [];
199+
$selections = $options[$optionId]['selections'];
200+
array_walk($selections, function(&$selection, $selectionId) use ($preConfiguredQtys) {
201+
if (is_array($preConfiguredQtys) && isset($preConfiguredQtys[$selectionId])) {
202+
$selection['qty'] = $preConfiguredQtys[$selectionId];
203+
} else if ((int)$preConfiguredQtys > 0) {
204+
$selection['qty'] = $preConfiguredQtys;
205+
}
206+
});
207+
$options[$optionId]['selections'] = $selections;
196208
}
197209
$position++;
198210
}

0 commit comments

Comments
 (0)