69 $store = $this->storeManager->getStore();
71 $storeLocale = $this->scopeConfig->getValue(
72 'general/locale/code',
77 $countries = $this->directoryHelper->getCountryCollection(
$store);
78 $regions = $this->directoryHelper->getRegionData();
79 foreach ($countries as
$data) {
80 $countryInfo = $this->
setCountryInfo($data, $regions, $storeLocale);
81 $countriesInfo[] = $countryInfo;
84 return $countriesInfo;
92 $store = $this->storeManager->getStore();
93 $storeLocale = $this->scopeConfig->getValue(
94 'general/locale/code',
99 $countriesCollection = $this->directoryHelper->getCountryCollection(
$store)->load();
100 $regions = $this->directoryHelper->getRegionData();
101 $country = $countriesCollection->getItemById($countryId);
106 "The country isn't available." 110 $countryInfo = $this->
setCountryInfo($country, $regions, $storeLocale);
125 $countryId = $country->getCountryId();
126 $countryInfo = $this->countryInformationFactory->create();
127 $countryInfo->setId($countryId);
128 $countryInfo->setTwoLetterAbbreviation($country->getData(
'iso2_code'));
129 $countryInfo->setThreeLetterAbbreviation($country->getData(
'iso3_code'));
130 $countryInfo->setFullNameLocale($country->getName($storeLocale));
131 $countryInfo->setFullNameEnglish($country->getName(
'en_US'));
133 if (array_key_exists($countryId, $regions)) {
135 foreach ($regions[$countryId] as
$id => $regionData) {
136 $regionInfo = $this->regionInformationFactory->create();
137 $regionInfo->setId(
$id);
138 $regionInfo->setCode($regionData[
'code']);
139 $regionInfo->setName($regionData[
'name']);
140 $regionsInfo[] = $regionInfo;
142 $countryInfo->setAvailableRegions($regionsInfo);