From 39f2dde909905eccd52d502802d0620a04b1cbd3 Mon Sep 17 00:00:00 2001 From: Jakob Meissner Date: Mon, 25 Sep 2017 12:13:49 +0200 Subject: [PATCH 1/2] Download link does not get rendered in invoice email --- .../Block/Sales/Order/Email/Items/Downloadable.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Downloadable/Block/Sales/Order/Email/Items/Downloadable.php b/app/code/Magento/Downloadable/Block/Sales/Order/Email/Items/Downloadable.php index 07757a975cb4e..bd3510eede394 100644 --- a/app/code/Magento/Downloadable/Block/Sales/Order/Email/Items/Downloadable.php +++ b/app/code/Magento/Downloadable/Block/Sales/Order/Email/Items/Downloadable.php @@ -68,12 +68,12 @@ public function __construct( public function getLinks() { $this->_purchased = $this->_purchasedFactory->create()->load( - $this->getItem()->getId(), + $this->getItem()->getOrderItemId(), 'order_item_id' ); $purchasedLinks = $this->_itemsFactory->create()->addFieldToFilter( 'order_item_id', - $this->getItem()->getId() + $this->getItem()->getOrderItemId() ); $this->_purchased->setPurchasedItems($purchasedLinks); From cdd854ba82cc03d2d3f05d5ff803f731af85ab61 Mon Sep 17 00:00:00 2001 From: Jakob Meissner Date: Thu, 5 Oct 2017 11:48:23 +0200 Subject: [PATCH 2/2] update test to reflect change --- .../Block/Sales/Order/Email/Items/DownloadableTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Downloadable/Test/Unit/Block/Sales/Order/Email/Items/DownloadableTest.php b/app/code/Magento/Downloadable/Test/Unit/Block/Sales/Order/Email/Items/DownloadableTest.php index 524b01729ff65..8a4ecfae58a79 100644 --- a/app/code/Magento/Downloadable/Test/Unit/Block/Sales/Order/Email/Items/DownloadableTest.php +++ b/app/code/Magento/Downloadable/Test/Unit/Block/Sales/Order/Email/Items/DownloadableTest.php @@ -59,7 +59,7 @@ public function testGetLinks() { $item = $this->getMockBuilder(\Magento\Sales\Model\Order\Item::class) ->disableOriginalConstructor() - ->setMethods(['getId']) + ->setMethods(['getOrderItemId']) ->getMock(); $linkPurchased = $this->getMockBuilder(\Magento\Downloadable\Model\Link\Purchased::class) ->disableOriginalConstructor() @@ -73,12 +73,12 @@ public function testGetLinks() $this->block->setData('item', $item); $this->purchasedFactory->expects($this->once())->method('create')->willReturn($linkPurchased); - $linkPurchased->expects($this->once())->method('load')->with('itemId', 'order_item_id')->willReturnSelf(); - $item->expects($this->any())->method('getId')->willReturn('itemId'); + $linkPurchased->expects($this->once())->method('load')->with('orderItemId', 'order_item_id')->willReturnSelf(); + $item->expects($this->any())->method('getOrderItemId')->willReturn('orderItemId'); $this->itemsFactory->expects($this->once())->method('create')->willReturn($itemCollection); $itemCollection->expects($this->once()) ->method('addFieldToFilter') - ->with('order_item_id', 'itemId') + ->with('order_item_id', 'orderItemId') ->willReturnSelf(); $this->assertEquals($linkPurchased, $this->block->getLinks());