Skip to content

Commit 2cea5b6

Browse files
#39169: Special Price To Date is wrongly validated on applySpecialPrice
- fix for tests
1 parent cf359ba commit 2cea5b6

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

app/code/Magento/Bundle/Model/Product/Price.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,9 @@ public function calculateSpecialPrice(
630630
) {
631631
if ($specialPrice !== null && $specialPrice != false) {
632632

633-
if ($specialPriceTo && date('H:i:s', strtotime($specialPriceTo)) !== '00:00:00') {
633+
if ($specialPriceTo
634+
&& strtotime($specialPriceTo) !== false
635+
&& date('H:i:s', strtotime($specialPriceTo)) !== '00:00:00') {
634636
$dateToTimestamp = strtotime($specialPriceTo);
635637
$specialPriceTo = date('Y-m-d H:i:s', $dateToTimestamp - 86400);
636638
}

app/code/Magento/Catalog/Model/Product/Type/Price.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,9 @@ public function calculateSpecialPrice(
643643
) {
644644
if ($specialPrice !== null && $specialPrice != false) {
645645

646-
if ($specialPriceTo && date('H:i:s', strtotime($specialPriceTo)) !== '00:00:00') {
646+
if ($specialPriceTo
647+
&& strtotime($specialPriceTo) !== false
648+
&& date('H:i:s', strtotime($specialPriceTo)) !== '00:00:00') {
647649
$dateToTimestamp = strtotime($specialPriceTo);
648650
$specialPriceTo = date('Y-m-d H:i:s', $dateToTimestamp - 86400);
649651
}

app/code/Magento/Catalog/Pricing/Price/SpecialPrice.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class SpecialPrice extends AbstractPrice implements SpecialPriceInterface, BaseP
2121
/**
2222
* Price type special
2323
*/
24-
const PRICE_CODE = 'special_price';
24+
public const string PRICE_CODE = 'special_price';
2525

2626
/**
2727
* @var TimezoneInterface
@@ -104,7 +104,9 @@ public function getSpecialToDate()
104104
public function isScopeDateInInterval()
105105
{
106106
$dateTo = $this->getSpecialToDate();
107-
if ($dateTo && date('H:i:s', strtotime($dateTo)) !== '00:00:00') {
107+
if ($dateTo
108+
&& strtotime($dateTo) !== false
109+
&& date('H:i:s', strtotime($dateTo)) !== '00:00:00') {
108110
$dateToTimestamp = strtotime($dateTo);
109111
$dateTo = date('Y-m-d H:i:s', $dateToTimestamp - 86400);
110112
}

0 commit comments

Comments
 (0)