-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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 #1456 from magento-engcom/2.1-develop-prs
[EngCom] Public Pull Requests - 2.1 - MAGETWO-72252: Backport of MAGETWO-52577 for Magento 2.1: [GitHub] Set Product as Ne… #10751 - MAGETWO-72251: Backport of MAGETWO-65607 for Magento 2.1: [GitHub][PR] Check return … #10750 - MAGETWO-71643: [BUGFIX] Flat Category reindexList of AllChildren if the url_key of t… #10557
- Loading branch information
Showing
9 changed files
with
93 additions
and
13 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
45 changes: 45 additions & 0 deletions
45
app/code/Magento/Catalog/Observer/SetSpecialPriceStartDate.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,45 @@ | ||
<?php | ||
/** | ||
* Copyright © 2013-2017 Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Catalog\Observer; | ||
|
||
use Magento\Framework\Event\ObserverInterface; | ||
|
||
/** | ||
* Set value for Special Price start date | ||
*/ | ||
class SetSpecialPriceStartDate implements ObserverInterface | ||
{ | ||
/** | ||
* @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface | ||
*/ | ||
private $localeDate; | ||
|
||
/** | ||
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate | ||
* @codeCoverageIgnore | ||
*/ | ||
public function __construct(\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate) | ||
{ | ||
$this->localeDate = $localeDate; | ||
} | ||
|
||
/** | ||
* Set the current date to Special Price From attribute if it empty | ||
* | ||
* @param \Magento\Framework\Event\Observer $observer | ||
* @return $this | ||
*/ | ||
public function execute(\Magento\Framework\Event\Observer $observer) | ||
{ | ||
/** @var $product \Magento\Catalog\Model\Product */ | ||
$product = $observer->getEvent()->getProduct(); | ||
if ($product->getSpecialPrice() && !$product->getSpecialFromDate()) { | ||
$product->setData('special_from_date', $this->localeDate->date()); | ||
} | ||
|
||
return $this; | ||
} | ||
} |
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
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