-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4485 from magento-arcticfoxes/MC-5777
MC-5777: Catalog rule does not apply as expected in EE
- Loading branch information
Showing
18 changed files
with
232 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\CatalogRule\Model; | ||
|
||
/** | ||
* Local date for catalog rule | ||
*/ | ||
class RuleDateFormatter implements \Magento\CatalogRule\Model\RuleDateFormatterInterface | ||
{ | ||
/** | ||
* @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface | ||
*/ | ||
private $localeDate; | ||
|
||
/** | ||
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate | ||
*/ | ||
public function __construct(\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate) | ||
{ | ||
$this->localeDate = $localeDate; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getDate($scope = null): \DateTime | ||
{ | ||
return $this->localeDate->scopeDate($scope, null, true); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getTimeStamp($scope = null): int | ||
{ | ||
return $this->localeDate->scopeTimeStamp($scope); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
app/code/Magento/CatalogRule/Model/RuleDateFormatterInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\CatalogRule\Model; | ||
|
||
/** | ||
* Local date for catalog rule | ||
*/ | ||
interface RuleDateFormatterInterface | ||
{ | ||
/** | ||
* Create \DateTime object with date converted to scope timezone for catalog rule | ||
* | ||
* @param mixed $scope Information about scope | ||
* @return \DateTime | ||
*/ | ||
public function getDate($scope = null): \DateTime; | ||
|
||
/** | ||
* Get scope timestamp for catalog rule | ||
* | ||
* @param mixed $scope Information about scope | ||
* @return int | ||
*/ | ||
public function getTimeStamp($scope = null): int; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.