Skip to content

Commit 36e6e6f

Browse files
committed
Merge branch 'ACP2E-2252' of https://github.com/magento-l3/magento2ce into Tier4-PR-10-30-2023
2 parents 81e372b + 7491f97 commit 36e6e6f

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

app/code/Magento/Bundle/Model/LinkManagement.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ private function processLinkedProduct(
235235
}
236236

237237
$selectionModel = $this->bundleSelection->create();
238+
$selectionModel->load($linkedProduct->getId());
238239
$selectionModel = $this->mapProductLinkToBundleSelectionModel(
239240
$selectionModel,
240241
$linkedProduct,

app/code/Magento/Bundle/Model/Selection.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Bundle\Model;
77

8+
use Magento\Framework\App\ObjectManager;
9+
810
/**
911
* Bundle Selection Model
1012
*
@@ -36,8 +38,6 @@
3638
class Selection extends \Magento\Framework\Model\AbstractModel
3739
{
3840
/**
39-
* Catalog data
40-
*
4141
* @var \Magento\Catalog\Helper\Data
4242
*/
4343
protected $_catalogData;
@@ -82,7 +82,9 @@ public function beforeSave()
8282
{
8383
if (!$this->_catalogData->isPriceGlobal() && $this->getWebsiteId()) {
8484
$this->setData('tmp_selection_price_value', $this->getSelectionPriceValue());
85+
$this->setData('tmp_selection_price_type', $this->getSelectionPriceType());
8586
$this->setSelectionPriceValue($this->getOrigData('selection_price_value'));
87+
$this->setSelectionPriceType($this->getOrigData('selection_price_type'));
8688
}
8789
parent::beforeSave();
8890
}
@@ -98,6 +100,9 @@ public function afterSave()
98100
if (null !== $this->getData('tmp_selection_price_value')) {
99101
$this->setSelectionPriceValue($this->getData('tmp_selection_price_value'));
100102
}
103+
if (null !== $this->getData('tmp_selection_price_type')) {
104+
$this->setSelectionPriceType($this->getData('tmp_selection_price_type'));
105+
}
101106
$this->getResource()->saveSelectionPrice($this);
102107

103108
if (!$this->getDefaultPriceScope()) {

app/code/Magento/Bundle/Test/Unit/Model/LinkManagementTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ public function testAddChildCouldNotSave(): void
621621
->method('create')
622622
->willReturn($bundle);
623623

624-
$selection = $this->createPartialMock(Selection::class, ['save']);
624+
$selection = $this->createPartialMock(Selection::class, ['save', 'load']);
625625
$selection->expects($this->once())->method('save')
626626
->willReturnCallback(
627627
static function () {
@@ -696,7 +696,7 @@ public function testAddChild(): void
696696
->willReturn($selections);
697697
$this->bundleFactoryMock->expects($this->once())->method('create')->willReturn($bundle);
698698

699-
$selection = $this->createPartialMock(Selection::class, ['save', 'getId']);
699+
$selection = $this->createPartialMock(Selection::class, ['save', 'getId', 'load']);
700700
$selection->expects($this->once())->method('save');
701701
$selection->expects($this->once())->method('getId')->willReturn(42);
702702
$this->bundleSelectionMock->expects($this->once())->method('create')->willReturn($selection);

0 commit comments

Comments
 (0)