Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-catalog
Observer
SetSpecialPriceStartDate.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Catalog\Observer
;
7
8
use
Magento\Framework\Event\ObserverInterface
;
9
13
class
SetSpecialPriceStartDate
implements
ObserverInterface
14
{
18
private
$localeDate;
19
24
public
function
__construct
(\
Magento
\Framework\Stdlib\DateTime\TimezoneInterface $localeDate)
25
{
26
$this->localeDate = $localeDate;
27
}
28
35
public
function
execute
(\
Magento
\Framework\Event\
Observer
$observer
)
36
{
38
$product
=
$observer
->getEvent()->getProduct();
39
if
(
$product
->getSpecialPrice() && !
$product
->getSpecialFromDate()) {
40
$product
->setData(
'special_from_date'
, $this->localeDate->date());
41
}
42
43
return
$this;
44
}
45
}
Magento\Framework\Event\ObserverInterface
Definition:
ObserverInterface.php:16
Magento\Catalog\Observer\SetSpecialPriceStartDate
Definition:
SetSpecialPriceStartDate.php:13
Magento\Catalog\Observer\SetSpecialPriceStartDate\__construct
__construct(\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate)
Definition:
SetSpecialPriceStartDate.php:24
Magento\Catalog\Observer
Definition:
SwitchPriceAttributeScopeOnConfigChangeTest.php:6
$observer
$observer
Definition:
second_website_with_second_currency.php:38
Magento
$product
$product
Definition:
bundle_product_with_not_visible_children.php:22
Magento\Framework\Event\ObserverInterface\execute
execute(Observer $observer)
Magento\Framework\Event\Observer
Definition:
Observer.php:14