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
SynchronizeWebsiteAttributesOnStoreChange.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Catalog\Observer
;
8
9
use
Magento\Catalog\Model\ResourceModel\Attribute\WebsiteAttributesSynchronizer
;
10
use
Magento\Framework\Event\Observer
;
11
use
Magento\Framework\Event\ObserverInterface
;
12
use
Magento\Store\Model\Store
;
13
18
class
SynchronizeWebsiteAttributesOnStoreChange
implements
ObserverInterface
19
{
23
private
$synchronizer;
24
29
public
function
__construct
(
WebsiteAttributesSynchronizer
$synchronizer)
30
{
31
$this->synchronizer = $synchronizer;
32
}
33
37
public
function
execute
(
Observer
$observer
)
38
{
39
$store
=
$observer
->getData(
'data_object'
);
40
if
(!
$store
instanceof
Store
) {
41
return
;
42
}
43
44
if
(!
$store
->hasDataChanges()) {
45
return
;
46
}
47
48
$isWebsiteIdChanged =
$store
->getOrigData(
'website_id'
) !=
$store
->getWebsiteId();
49
$isStoreNew =
$store
->isObjectNew();
50
51
if
($isWebsiteIdChanged || $isStoreNew) {
52
$this->synchronizer->scheduleSynchronization();
53
}
54
}
55
}
Magento\Catalog\Observer\SynchronizeWebsiteAttributesOnStoreChange
Definition:
SynchronizeWebsiteAttributesOnStoreChange.php:18
Magento\Catalog\Model\ResourceModel\Attribute\WebsiteAttributesSynchronizer
Definition:
WebsiteAttributesSynchronizer.php:22
Magento\Framework\Event\ObserverInterface
Definition:
ObserverInterface.php:16
Magento\Catalog\Observer
Definition:
SwitchPriceAttributeScopeOnConfigChangeTest.php:6
Magento\Catalog\Observer\SynchronizeWebsiteAttributesOnStoreChange\__construct
__construct(WebsiteAttributesSynchronizer $synchronizer)
Definition:
SynchronizeWebsiteAttributesOnStoreChange.php:29
$observer
$observer
Definition:
second_website_with_second_currency.php:38
Magento\Catalog\Observer\SynchronizeWebsiteAttributesOnStoreChange\execute
execute(Observer $observer)
Definition:
SynchronizeWebsiteAttributesOnStoreChange.php:37
Magento\Framework\Event\Observer
Definition:
Collection.php:12
$store
$store
Definition:
payment_configuration_rollback.php:33
Magento\Store\Model\Store
Definition:
Store.php:38
Magento\Framework\Event\Observer
Definition:
Observer.php:14