Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 91b0a97

Browse files
MAGETWO-80371: Exception when product added to cart with tiered price reduced to $0.00
1 parent 92f8966 commit 91b0a97

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Backend/TierpriceTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ public function testSetPriceData()
141141
{
142142
$attributeName = 'tier_price';
143143
$tierPrices = [
144+
[
145+
'price' => 0,
146+
'all_groups' => 1,
147+
],
144148
[
145149
'price' => 10,
146150
'all_groups' => 1,
@@ -153,6 +157,12 @@ public function testSetPriceData()
153157
$productPrice = 20;
154158
$allCustomersGroupId = 32000;
155159
$finalTierPrices = [
160+
[
161+
'price' => 0,
162+
'all_groups' => 1,
163+
'website_price' => 0,
164+
'cust_group' => 32000,
165+
],
156166
[
157167
'price' => 10,
158168
'all_groups' => 1,
@@ -170,8 +180,8 @@ public function testSetPriceData()
170180
->disableOriginalConstructor()->getMock();
171181
$allCustomersGroup = $this->getMockBuilder(\Magento\Customer\Api\Data\GroupInterface::class)
172182
->disableOriginalConstructor()->getMock();
173-
$this->groupManagement->expects($this->once())->method('getAllCustomersGroup')->willReturn($allCustomersGroup);
174-
$allCustomersGroup->expects($this->once())->method('getId')->willReturn($allCustomersGroupId);
183+
$this->groupManagement->expects($this->exactly(2))->method('getAllCustomersGroup')->willReturn($allCustomersGroup);
184+
$allCustomersGroup->expects($this->exactly(2))->method('getId')->willReturn($allCustomersGroupId);
175185
$object->expects($this->once())->method('getPrice')->willReturn($productPrice);
176186
$this->attribute->expects($this->atLeastOnce())->method('isScopeGlobal')->willReturn(true);
177187
$object->expects($this->once())->method('getStoreId')->willReturn(null);

tier_price.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php
2+
index f7ab3f5..cd686c0 100644
3+
--- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php
4+
+++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/GroupPrice/AbstractGroupPrice.php
5+
@@ -360,7 +360,7 @@ abstract class AbstractGroupPrice extends Price
6+
{
7+
/** @var array $priceItem */
8+
foreach ($data as $key => $priceItem) {
9+
- if (isset($priceItem['price']) && $priceItem['price'] > 0) {
10+
+ if (array_key_exists('price', $priceItem)) {
11+
$data[$key]['website_price'] = $priceItem['price'];
12+
}
13+
if ($priceItem['all_groups']) {

0 commit comments

Comments
 (0)