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-customer
Model
Plugin
AllowedCountries.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Customer\Model\Plugin
;
8
9
use
Magento\Customer\Model\Config\Share
;
10
use
Magento\Store\Api\Data\WebsiteInterface
;
11
use
Magento\Store\Model\ScopeInterface
;
12
use
Magento\Store\Model\StoreManagerInterface
;
13
17
class
AllowedCountries
18
{
22
private
$shareConfig;
23
27
private
$storeManager;
28
33
public
function
__construct
(
34
Share
$share,
35
StoreManagerInterface
$storeManager
36
) {
37
$this->shareConfig = $share;
38
$this->storeManager =
$storeManager
;
39
}
40
50
public
function
beforeGetAllowedCountries
(
51
\
Magento
\Directory\Model\
AllowedCountries
$subject,
52
$scope =
ScopeInterface::SCOPE_WEBSITE
,
53
$scopeCode =
null
54
) {
55
if
($this->shareConfig->isGlobalScope()) {
56
//Check if we have shared accounts - than merge all website allowed countries
57
$scopeCode = array_map(
function
(
WebsiteInterface
$website
) {
58
return
$website
->getId();
59
}, $this->storeManager->getWebsites());
60
$scope =
ScopeInterface::SCOPE_WEBSITES
;
61
}
62
63
return
[$scope, $scopeCode];
64
}
65
}
$website
$website
Definition:
payment_configuration_rollback.php:38
Magento\Customer\Model\Plugin\AllowedCountries\__construct
__construct(Share $share, StoreManagerInterface $storeManager)
Definition:
AllowedCountries.php:33
$storeManager
$storeManager
Definition:
paypal_quote.php:14
Magento\Store\Model\ScopeInterface\SCOPE_WEBSITES
const SCOPE_WEBSITES
Definition:
ScopeInterface.php:19
Magento\Store\Model\StoreManagerInterface
Definition:
StoreManagerInterface.php:17
Magento\Store\Model\ScopeInterface
Definition:
ScopeInterface.php:12
Magento\Customer\Model\Plugin\AllowedCountries\beforeGetAllowedCountries
beforeGetAllowedCountries(\Magento\Directory\Model\AllowedCountries $subject, $scope=ScopeInterface::SCOPE_WEBSITE, $scopeCode=null)
Definition:
AllowedCountries.php:50
Magento\Store\Api\Data\WebsiteInterface
Definition:
WebsiteInterface.php:14
Magento
Magento\Customer\Model\Config\Share
Definition:
Share.php:13
Magento\Customer\Model\Plugin\AllowedCountries
Definition:
AllowedCountries.php:17
Magento\Store\Model\ScopeInterface\SCOPE_WEBSITE
const SCOPE_WEBSITE
Definition:
ScopeInterface.php:23
Magento\Customer\Model\Plugin
Definition:
AllowedCountries.php:7