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
magento2-base
dev
tests
integration
testsuite
Magento
Signifyd
_files
website_configuration.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
use
Magento\Config\Model\Config
;
9
use
Magento\Framework\App\Config\ScopeConfigInterface
;
10
use
Magento\Store\Model\ResourceModel\Store
as
StoreResourceModel
;
11
use
Magento\Store\Model\ResourceModel\Website
as
WebsiteResourceModel
;
12
use
Magento\Store\Model\ScopeInterface
;
13
use
Magento\Store\Model\Store
;
14
use
Magento\Store\Model\StoreManagerInterface
;
15
use
Magento\Store\Model\Website
;
16
use
Magento\TestFramework\Helper\Bootstrap
;
17
18
$objectManager
= Bootstrap::getObjectManager();
19
21
$website
=
$objectManager
->create(Website::class);
22
$website
->setData([
'code'
=>
'test_website'
,
'name'
=>
'Test Website'
,
'default_group_id'
=>
'1'
,
'is_default'
=>
'0'
]);
23
$websiteResourceModel
=
$objectManager
->create(WebsiteResourceModel::class);
24
$websiteResourceModel
->save(
$website
);
25
26
$websiteId
=
$website
->getId();
27
$store
=
$objectManager
->create(Store::class);
28
$groupId
= Bootstrap::getObjectManager()->get(StoreManagerInterface::class)
29
->getWebsite()
30
->getDefaultGroupId();
31
$store
->setCode(
'test_second_store'
)
32
->setWebsiteId(
$websiteId
)
33
->setGroupId(
$groupId
)
34
->setName(
'Test Second Store'
)
35
->setSortOrder(10)
36
->setIsActive(1);
37
$storeResourceModel
=
$objectManager
->create(StoreResourceModel::class);
38
$storeResourceModel
->save(
$store
);
39
40
/* Refresh stores memory cache */
41
$objectManager
->get(StoreManagerInterface::class)->reinitStores();
42
43
$processConfigData
=
function
(
Config
$config
, array
$data
) {
44
foreach
(
$data
as $key =>
$value
) {
45
$config
->setDataByPath($key,
$value
);
46
$config
->save();
47
}
48
};
49
50
// save signifyd configuration for the default scope
51
$configData
= [
52
'fraud_protection/signifyd/active'
=>
'1'
,
53
];
55
$defConfig
=
$objectManager
->create(Config::class);
56
$defConfig
->setScope(ScopeConfigInterface::SCOPE_TYPE_DEFAULT);
57
$processConfigData
(
$defConfig
,
$configData
);
58
59
// save signifyd website config data
60
$websiteConfigData
= [
61
'fraud_protection/signifyd/active'
=>
'0'
,
62
];
64
$websiteConfig
=
$objectManager
->create(Config::class);
65
$websiteConfig
->setScope(ScopeInterface::SCOPE_WEBSITES);
66
$websiteConfig
->setWebsite(
$websiteId
);
67
$processConfigData
(
$websiteConfig
,
$websiteConfigData
);
$websiteId
$websiteId
Definition:
website_configuration.php:26
Magento\Store\Model\ResourceModel\Store
Definition:
CollectionTest.php:6
$storeResourceModel
$storeResourceModel
Definition:
website_configuration.php:37
Magento\TestFramework\Helper\Bootstrap
Definition:
Bootstrap.php:12
$config
$config
Definition:
fraud_order.php:17
Magento\Store\Model\ResourceModel\Website
Definition:
Collection.php:6
$websiteConfig
$websiteConfig
Definition:
website_configuration.php:64
$defConfig
$defConfig
Definition:
website_configuration.php:55
$websiteResourceModel
$websiteResourceModel
Definition:
website_configuration.php:23
Magento\Store\Model\Website
Definition:
Website.php:26
$store
$store
Definition:
website_configuration.php:27
$objectManager
$objectManager
Definition:
website_configuration.php:18
$configData
$configData
Definition:
website_configuration.php:51
Magento\Store\Model\StoreManagerInterface
Definition:
StoreManagerInterface.php:17
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
$value
$value
Definition:
gender.phtml:16
Magento\Store\Model\ScopeInterface
Definition:
ScopeInterface.php:12
$processConfigData
$processConfigData
Definition:
website_configuration.php:43
$groupId
$groupId
Definition:
website_configuration.php:28
Magento\Store\Model\Store
Definition:
Store.php:38
Magento\Config\Model\Config
Magento\Framework\App\Config
Definition:
Config.php:17
$website
$website
Definition:
website_configuration.php:21
Magento\Framework\App\Config\ScopeConfigInterface
Definition:
ScopeConfigInterface.php:15
$websiteConfigData
$websiteConfigData
Definition:
website_configuration.php:60