Skip to content

Commit 0b58de7

Browse files
author
Yu Tang
committed
MAGETWO-44639: Incorrect prices in shopping cart when MAP is enabled and catalog prices is including tax
1 parent 02e0378 commit 0b58de7

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

app/code/Magento/Quote/Model/Quote/Address/Total/Subtotal.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ protected function _initItem($address, $item)
104104
}
105105
}
106106

107+
$quoteItem->setConvertedPrice(null);
107108
$originalPrice = $product->getPrice();
108109
if ($quoteItem->getParentItem() && $quoteItem->isChildrenCalculated()) {
109110
$finalPrice = $quoteItem->getParentItem()->getProduct()->getPriceModel()->getChildFinalPrice(

app/code/Magento/Quote/Test/Unit/Model/Quote/Address/Total/SubtotalTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public function testCollect($price, $originalPrice, $itemHasParent, $expectedPri
7878
$this->stockRegistry->expects($this->any())->method('getStockItem')->willReturn($this->stockItemMock);
7979

8080
$priceCurrency = $this->getMockBuilder('Magento\Framework\Pricing\PriceCurrencyInterface')->getMock();
81+
$convertedPrice = 1231313;
8182
// @TODO this is a wrong test and it does not check methods. Any digital value will be correct
8283
$priceCurrency->expects($this->any())->method('convert')->willReturn(1231313);
8384

@@ -114,14 +115,16 @@ public function testCollect($price, $originalPrice, $itemHasParent, $expectedPri
114115
$product->expects($this->any())->method('isVisibleInCatalog')->will($this->returnValue(true));
115116

116117
$quote->expects($this->any())->method('getStore')->will($this->returnValue($store));
117-
$quoteItem->setProduct($product)->setQuote($quote)->setOriginalCustomPrice($price);
118+
$quoteItem->setProduct($product)->setQuote($quote);
118119

119120
$parentQuoteItem = false;
120121
if ($itemHasParent) {
121122
$parentQuoteItem = $this->getMock('Magento\Quote\Model\Quote\Item', [], [], '', false);
122123
$parentQuoteItem->expects($this->any())->method('getProduct')->will($this->returnValue($product));
123124
}
124125
$quoteItem->setParentItem($parentQuoteItem);
126+
//This value will be overwritten
127+
$quoteItem->setConvertedPrice(10);
125128

126129
$priceModel = $this->getMock('\Magento\Catalog\Model\Product\Type\Price', [], [], '', false);
127130
$priceModel->expects($this->any())->method('getChildFinalPrice')->willReturn($price);
@@ -149,6 +152,8 @@ public function testCollect($price, $originalPrice, $itemHasParent, $expectedPri
149152

150153
$this->assertEquals($expectedPrice, $quoteItem->getPrice());
151154
$this->assertEquals($expectedOriginalPrice, $quoteItem->getBaseOriginalPrice());
155+
$this->assertEquals($convertedPrice, $quoteItem->getCalculationPrice());
156+
$this->assertEquals($convertedPrice, $quoteItem->getConvertedPrice());
152157
}
153158

154159
public function testFetch()

0 commit comments

Comments
 (0)