From f5734a81c9dc8a93dd830d25f8514106139abe9f Mon Sep 17 00:00:00 2001 From: Jeroen Date: Tue, 10 Apr 2018 11:40:55 +0200 Subject: [PATCH] Update ItemRepository.php --- .../Magento/Sales/Model/Order/ItemRepository.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/code/Magento/Sales/Model/Order/ItemRepository.php b/app/code/Magento/Sales/Model/Order/ItemRepository.php index e2a1cd7219c92..fbc55a7394fc0 100644 --- a/app/code/Magento/Sales/Model/Order/ItemRepository.php +++ b/app/code/Magento/Sales/Model/Order/ItemRepository.php @@ -114,6 +114,7 @@ public function get($id) } $this->addProductOption($orderItem); + $this->addParentItem($orderItem); $this->registry[$id] = $orderItem; } return $this->registry[$id]; @@ -134,6 +135,7 @@ public function getList(SearchCriteriaInterface $searchCriteria) /** @var OrderItemInterface $orderItem */ foreach ($searchResult->getItems() as $orderItem) { $this->addProductOption($orderItem); + $this->addParentItem($orderItem); } return $searchResult; @@ -213,6 +215,20 @@ protected function addProductOption(OrderItemInterface $orderItem) return $this; } + /** + * Set parent item. + * + * @param OrderItemInterface $orderItem + * @throws InputException + * @throws NoSuchEntityException + */ + private function addParentItem(OrderItemInterface $orderItem) + { + if ($parentId = $orderItem->getParentItemId()) { + $orderItem->setParentItem($this->get($parentId)); + } + } + /** * Set product options data *