Skip to content

Commit b6180be

Browse files
ENGCOM-3450: [Forwardport] Fixed tierprice discount not calculated correctly if has specialprice #19179
- Merge Pull Request #19179 from torhoehn/magento2:2.3-develop-PR-port-18743 - Merged commits: 1. 8f463db 2. 63c9ea4 3. 77492c1 4. d0ba997
2 parents 5f976fa + d0ba997 commit b6180be

File tree

1 file changed

+14
-0
lines changed
  • app/code/Magento/Catalog/Model/Product/Attribute/Backend

1 file changed

+14
-0
lines changed

app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,22 @@ protected function validatePrice(array $priceRow)
159159
*/
160160
protected function modifyPriceData($object, $data)
161161
{
162+
/** @var \Magento\Catalog\Model\Product $object */
162163
$data = parent::modifyPriceData($object, $data);
163164
$price = $object->getPrice();
165+
166+
$specialPrice = $object->getSpecialPrice();
167+
$specialPriceFromDate = $object->getSpecialFromDate();
168+
$specialPriceToDate = $object->getSpecialToDate();
169+
$today = time();
170+
171+
if ($specialPrice && ($object->getPrice() > $object->getFinalPrice())) {
172+
if ($today >= strtotime($specialPriceFromDate) && $today <= strtotime($specialPriceToDate) ||
173+
$today >= strtotime($specialPriceFromDate) && $specialPriceToDate === null) {
174+
$price = $specialPrice;
175+
}
176+
}
177+
164178
foreach ($data as $key => $tierPrice) {
165179
$percentageValue = $this->getPercentage($tierPrice);
166180
if ($percentageValue) {

0 commit comments

Comments
 (0)