Skip to content

Commit 8f463db

Browse files
gelanivishaltorhoehn
authored andcommitted
Added tier price logic for special price
1 parent 5f976fa commit 8f463db

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) && is_null($specialPriceToDate)) {
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)