diff --git a/app/code/Magento/Customer/Model/Customer/DataProvider.php b/app/code/Magento/Customer/Model/Customer/DataProvider.php index 8d2c8fbe442250a39e07f0d47fd4851caf4eb214..2f46459a794eca284e91c1dddf3c2e39def0cd9f 100644 --- a/app/code/Magento/Customer/Model/Customer/DataProvider.php +++ b/app/code/Magento/Customer/Model/Customer/DataProvider.php @@ -321,7 +321,7 @@ class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider if ($attribute->usesSource()) { if ($code == AddressInterface::COUNTRY_ID) { - $meta[$code]['arguments']['data']['config']['options'] = $this->getcountryWithWebsiteSource() + $meta[$code]['arguments']['data']['config']['options'] = $this->getCountryWithWebsiteSource() ->getAllOptions(); } else { $meta[$code]['arguments']['data']['config']['options'] = $attribute->getSource()->getAllOptions(); diff --git a/app/code/Magento/Customer/Model/Plugin/AllowedCountries.php b/app/code/Magento/Customer/Model/Plugin/AllowedCountries.php index 366918f8b4e955eae4f09114cf5f8c0d56da0926..b49f63d94f806fb68620874a0df5cfc63ac53b3a 100644 --- a/app/code/Magento/Customer/Model/Plugin/AllowedCountries.php +++ b/app/code/Magento/Customer/Model/Plugin/AllowedCountries.php @@ -47,8 +47,8 @@ class AllowedCountries */ public function beforeGetAllowedCountries( \Magento\Directory\Model\AllowedCountries $subject, - $scopeCode = null, - $scope = ScopeInterface::SCOPE_WEBSITE + $scope = ScopeInterface::SCOPE_WEBSITE, + $scopeCode = null ) { if ($this->shareConfig->isGlobalScope()) { //Check if we have shared accounts - than merge all website allowed countries @@ -58,6 +58,6 @@ class AllowedCountries $scope = ScopeInterface::SCOPE_WEBSITES; } - return [$scopeCode, $scope]; + return [$scope, $scopeCode]; } } diff --git a/app/code/Magento/Customer/Model/ResourceModel/Address/Attribute/Source/CountryWithWebsites.php b/app/code/Magento/Customer/Model/ResourceModel/Address/Attribute/Source/CountryWithWebsites.php index 0cbebf49198efc1cadcf088bd799de01e04d7503..50ff13e2b245e0efc3a1f66370dabf6f0d8e8283 100644 --- a/app/code/Magento/Customer/Model/ResourceModel/Address/Attribute/Source/CountryWithWebsites.php +++ b/app/code/Magento/Customer/Model/ResourceModel/Address/Attribute/Source/CountryWithWebsites.php @@ -78,7 +78,7 @@ class CountryWithWebsites extends \Magento\Eav\Model\Entity\Attribute\Source\Tab if (!$this->shareConfig->isGlobalScope()) { foreach ($this->storeManager->getWebsites() as $website) { $countries = $this->allowedCountriesReader - ->getAllowedCountries($website->getId(), ScopeInterface::SCOPE_WEBSITE); + ->getAllowedCountries(ScopeInterface::SCOPE_WEBSITE, $website->getId()); $allowedCountries = array_merge($allowedCountries, $countries); foreach ($countries as $countryCode) { diff --git a/app/code/Magento/Customer/Setup/UpgradeData.php b/app/code/Magento/Customer/Setup/UpgradeData.php index a6fc60fe5355e2cb8b0e771ce1ea5eff0a6e238f..f503443c479d651b69202bb9c652cb7a8a0c78d7 100644 --- a/app/code/Magento/Customer/Setup/UpgradeData.php +++ b/app/code/Magento/Customer/Setup/UpgradeData.php @@ -203,7 +203,7 @@ class UpgradeData implements UpgradeDataInterface $allowedCountries = $this->mergeAllowedCountries( $allowedCountries, $this->getAllowedCountriesReader() - ->getAllowedCountries($store->getId(), ScopeInterface::SCOPE_STORE), + ->getAllowedCountries(ScopeInterface::SCOPE_STORE, $store->getId()), $store->getWebsiteId() ); } @@ -212,7 +212,7 @@ class UpgradeData implements UpgradeDataInterface $allowedCountries = $this->mergeAllowedCountries( $allowedCountries, $this->getAllowedCountriesReader() - ->getAllowedCountries($website->getId(), ScopeInterface::SCOPE_WEBSITE), + ->getAllowedCountries(ScopeInterface::SCOPE_WEBSITE, $website->getId()), $website->getId() ); } diff --git a/app/code/Magento/Directory/Model/AllowedCountries.php b/app/code/Magento/Directory/Model/AllowedCountries.php index 8f5ce54d602b5ee4cca1d4f00e5068e0cab574c4..9bdd531e7a0b88013f3ba5a703761aa6725791ff 100644 --- a/app/code/Magento/Directory/Model/AllowedCountries.php +++ b/app/code/Magento/Directory/Model/AllowedCountries.php @@ -49,8 +49,8 @@ class AllowedCountries * @return array */ public function getAllowedCountries( - $scopeCode = null, - $scope = ScopeInterface::SCOPE_WEBSITE + $scope = ScopeInterface::SCOPE_WEBSITE, + $scopeCode = null ) { if (empty($scopeCode)) { $scopeCode = $this->getDefaultScopeCode($scope); diff --git a/app/code/Magento/Directory/Model/ResourceModel/Country/Collection.php b/app/code/Magento/Directory/Model/ResourceModel/Country/Collection.php index 128a8afbcaa754e8ad57d3b131c7f384efe95ad1..1093e41b6da61037732eb40c29c40dfea78cb671 100644 --- a/app/code/Magento/Directory/Model/ResourceModel/Country/Collection.php +++ b/app/code/Magento/Directory/Model/ResourceModel/Country/Collection.php @@ -150,7 +150,7 @@ class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\Ab public function loadByStore($store = null) { $allowedCountries = $this->getAllowedCountriesReader() - ->getAllowedCountries($store, ScopeInterface::SCOPE_STORE); + ->getAllowedCountries(ScopeInterface::SCOPE_STORE, $store); if (!empty($allowedCountries)) { $this->addFieldToFilter("country_id", ['in' => $allowedCountries]); diff --git a/app/code/Magento/Directory/Test/Unit/Model/AllowedCountriesTest.php b/app/code/Magento/Directory/Test/Unit/Model/AllowedCountriesTest.php index a39770181c2dee38aa2c1340223883b2c86e773e..f5ed44753c43c40305f14895a60b7932818cdea0 100644 --- a/app/code/Magento/Directory/Test/Unit/Model/AllowedCountriesTest.php +++ b/app/code/Magento/Directory/Test/Unit/Model/AllowedCountriesTest.php @@ -67,27 +67,7 @@ class AllowedCountriesTest extends \PHPUnit_Framework_TestCase $this->assertEquals( ['AM' => 'AM'], - $this->allowedCountriesReader->getAllowedCountries(1, ScopeInterface::SCOPE_WEBSITE, true) + $this->allowedCountriesReader->getAllowedCountries(ScopeInterface::SCOPE_WEBSITE, true) ); } - -// public function testLoadByScope() -// { -// $this->scopeConfigMock->expects($this->once()) -// ->method('getValue') -// ->with(CountryHandlerInterface::ALLOWED_COUNTRIES_PATH, 'website', 1) -// ->willReturn('AM'); -// -// $collectionMock = $this->getMockBuilder(AbstractDb::class) -// ->disableOriginalConstructor() -// ->getMock(); -// $collectionMock->expects($this->once()) -// ->method('addFieldToFilter') -// ->with('country_id', ['in' => ['AM' => 'AM']]); -// -// $this->assertEquals( -// $collectionMock, -// $this->countryHandler->loadByScope($collectionMock, 1, ScopeInterface::SCOPE_WEBSITE) -// ); -// } }