Skip to content

Commit e8507db

Browse files
committed
MC-38592 Used store manager for retrieve current store by default in directory data helper
1 parent 226b08d commit e8507db

File tree

1 file changed

+13
-6
lines changed
  • app/code/Magento/Directory/Helper

1 file changed

+13
-6
lines changed

app/code/Magento/Directory/Helper/Data.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ public function getRegionJson()
190190
\Magento\Framework\Profiler::start('TEST: ' . __METHOD__, ['group' => 'TEST', 'method' => __METHOD__]);
191191
if (!$this->_regionJson) {
192192
$scope = $this->getCurrentScope();
193-
$scopeKey = $scope['value'] ? '_' . implode('_', $scope) : null;
194-
$cacheKey = 'DIRECTORY_REGIONS_JSON_STORE' . $scopeKey;
193+
$scopeKey = $scope['value'] ? '_' . implode('_', $scope) : '';
194+
$cacheKey = 'DIRECTORY_REGIONS_JSON' . $scopeKey;
195195
$json = $this->_configCacheType->load($cacheKey);
196196
if (empty($json)) {
197197
$regions = $this->getRegionData();
@@ -406,14 +406,21 @@ public function getWeightUnit()
406406
* Get current scope from request
407407
*
408408
* @return array
409+
* @throws \Magento\Framework\Exception\NoSuchEntityException
409410
*/
410411
private function getCurrentScope(): array
411412
{
412-
$scope = [
413-
'type' => ScopeConfigInterface::SCOPE_TYPE_DEFAULT,
414-
'value' => null,
415-
];
413+
$scope = $this->_storeManager->getStore()
414+
? [
415+
'type' => ScopeInterface::SCOPE_STORE,
416+
'value' => $this->_storeManager->getStore()->getId(),
417+
]
418+
: [
419+
'type' => ScopeConfigInterface::SCOPE_TYPE_DEFAULT,
420+
'value' => null,
421+
];
416422
$request = $this->_getRequest();
423+
417424
if ($request->getParam(ScopeInterface::SCOPE_WEBSITE)) {
418425
$scope = [
419426
'type' => ScopeInterface::SCOPE_WEBSITE,

0 commit comments

Comments
 (0)