Skip to content

Commit d7e6455

Browse files
committed
Merge remote-tracking branch 'github-magento/MAGETWO-91679' into EPAM-PR-16
2 parents 4f6588c + b0d7a26 commit d7e6455

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,11 @@ public function getSku($product)
308308
$selectionIds = $this->serializer->unserialize($customOption->getValue());
309309
if (!empty($selectionIds)) {
310310
$selections = $this->getSelectionsByIds($selectionIds, $product);
311-
foreach ($selections->getItems() as $selection) {
312-
$skuParts[] = $selection->getSku();
311+
foreach ($selectionIds as $selectionId) {
312+
$entity = $selections->getItemByColumnValue('selection_id', $selectionId);
313+
if (isset($entity) && $entity->getEntityId()) {
314+
$skuParts[] = $entity->getSku();
315+
}
313316
}
314317
}
315318
}

app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,7 +1583,7 @@ public function testGetSkuWithoutType()
15831583
->disableOriginalConstructor()
15841584
->getMock();
15851585
$selectionItemMock = $this->getMockBuilder(\Magento\Framework\DataObject::class)
1586-
->setMethods(['getSku', '__wakeup'])
1586+
->setMethods(['getSku', 'getEntityId', '__wakeup'])
15871587
->disableOriginalConstructor()
15881588
->getMock();
15891589

@@ -1611,9 +1611,12 @@ public function testGetSkuWithoutType()
16111611
->will($this->returnValue($serializeIds));
16121612
$selectionMock = $this->getSelectionsByIdsMock($selectionIds, $productMock, 5, 6);
16131613
$selectionMock->expects(($this->any()))
1614-
->method('getItems')
1615-
->will($this->returnValue([$selectionItemMock]));
1616-
$selectionItemMock->expects($this->any())
1614+
->method('getItemByColumnValue')
1615+
->will($this->returnValue($selectionItemMock));
1616+
$selectionItemMock->expects($this->at(0))
1617+
->method('getEntityId')
1618+
->will($this->returnValue(1));
1619+
$selectionItemMock->expects($this->once())
16171620
->method('getSku')
16181621
->will($this->returnValue($itemSku));
16191622

0 commit comments

Comments
 (0)