Skip to content

Commit 2d5e2b3

Browse files
author
Oleksandr Iegorov
committed
MAGETWO-69496: Impossible specify Bundle option title on store view level with changes to more than one store view
1 parent a57768e commit 2d5e2b3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

app/code/Magento/Bundle/Model/Product/SaveHandler.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ public function execute($entity, $arguments = [])
6767
$this->processRemovedOptions($entity->getSku(), $existingOptionsIds, $optionIds);
6868
$this->processExistedOptions($entity->getSku(), $existingOptionsIds, $optionIds);
6969

70-
$this->saveOptions($entity, $options);
70+
$newOptionsIds = array_diff($optionIds, $existingOptionsIds);
71+
$this->saveOptions($entity, $options, $newOptionsIds);
7172
} else {
7273
//save only labels and not selections + product links
7374
$this->saveOptions($entity, $options);
@@ -97,13 +98,17 @@ protected function removeOptionLinks($entitySku, $option)
9798
* Perform save for all options entities
9899
* @param object $entity
99100
* @param array $options
101+
* @param array $newOptionsIds
100102
* @throws \Magento\Framework\Exception\CouldNotSaveException
101103
* @throws \Magento\Framework\Exception\InputException
102104
* @return void
103105
*/
104-
private function saveOptions($entity, $options)
106+
private function saveOptions($entity, $options, $newOptionsIds = [])
105107
{
106108
foreach ($options as $option) {
109+
if (in_array($option->getOptionId(), $newOptionsIds)) {
110+
$option->setOptionId(null);
111+
}
107112
$this->optionRepository->save($entity, $option);
108113
}
109114
}

0 commit comments

Comments
 (0)