Skip to content

Commit c8e81d8

Browse files
MC-25235: Tier Prices error on product update
1 parent 148d6cc commit c8e81d8

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,7 @@ public function execute($entity, $arguments = [])
9696
$productId = (int)$entity->getData($identifierField);
9797

9898
// prepare original data to compare
99-
$origPrices = [];
100-
$originalId = $entity->getOrigData($identifierField);
101-
if (empty($originalId) || $entity->getData($identifierField) == $originalId) {
102-
$origPrices = $entity->getOrigData($attribute->getName());
103-
}
104-
99+
$origPrices = $entity->getOrigData($attribute->getName());
105100
$old = $this->prepareOldTierPriceToCompare($origPrices);
106101
// prepare data for save
107102
$new = $this->prepareNewDataForSave($priceRows, $isGlobal);

app/code/Magento/Catalog/Test/Unit/Model/Attribute/Backend/TierPrice/UpdateHandlerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ public function testExecute(): void
108108
];
109109
$linkField = 'entity_id';
110110
$productId = 10;
111+
$originalProductId = 11;
111112

112113
/** @var \PHPUnit_Framework_MockObject_MockObject $product */
113114
$product = $this->getMockBuilder(\Magento\Catalog\Api\Data\ProductInterface::class)
@@ -124,7 +125,7 @@ public function testExecute(): void
124125
->willReturnMap(
125126
[
126127
['tier_price', $originalTierPrices],
127-
['entity_id', $productId]
128+
['entity_id', $originalProductId]
128129
]
129130
);
130131
$product->expects($this->atLeastOnce())->method('getStoreId')->willReturn(0);

0 commit comments

Comments
 (0)