Skip to content

Commit 932c1f6

Browse files
🔃 [EngCom] Public Pull Requests - 2.2-develop
Accepted Public Pull Requests: - #18737: [BUGFIX] GITHUB-18264 Backport of #17799 for the 2.2 branch (by @kanduvisla) - #16940: Resolve incorrect scope code selection when the requested scopeCode is null (by @matthew-muscat) Fixed GitHub Issues: - #18264: M2.2.6 : "Order by price" not working in product listing (reported by @kanduvisla) has been fixed in #18737 by @kanduvisla in 2.2-develop branch Related commits: 1. 36a3c26 - #16939: Incorrect configuration scope is occasionally returned when attempting to resolve a null scope id (reported by @matthew-muscat) has been fixed in #16940 by @matthew-muscat in 2.2-develop branch Related commits: 1. d79cfa9 2. a9c4838 3. 93edb38
2 parents fdcab41 + 2014391 commit 932c1f6

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

app/code/Magento/Store/Model/StoreManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,11 @@ public function getWebsites($withDefault = false, $codeKey = false)
234234
public function reinitStores()
235235
{
236236
$this->currentStoreId = null;
237-
$this->cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, [StoreResolver::CACHE_TAG, Store::CACHE_TAG]);
238-
$this->scopeConfig->clean();
239237
$this->storeRepository->clean();
240238
$this->websiteRepository->clean();
241239
$this->groupRepository->clean();
240+
$this->cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, [StoreResolver::CACHE_TAG, Store::CACHE_TAG]);
241+
$this->scopeConfig->clean();
242242
}
243243

244244
/**

lib/internal/Magento/Framework/App/Config/ScopeCodeResolver.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\Framework\App\Config;
77

8+
use Magento\Framework\App\ScopeInterface;
89
use Magento\Framework\App\ScopeResolverPool;
910

1011
/**
@@ -34,28 +35,32 @@ public function __construct(ScopeResolverPool $scopeResolverPool)
3435
* Resolve scope code
3536
*
3637
* @param string $scopeType
37-
* @param string $scopeCode
38+
* @param string|null $scopeCode
3839
* @return string
3940
*/
4041
public function resolve($scopeType, $scopeCode)
4142
{
4243
if (isset($this->resolvedScopeCodes[$scopeType][$scopeCode])) {
4344
return $this->resolvedScopeCodes[$scopeType][$scopeCode];
4445
}
45-
if (($scopeCode === null || is_numeric($scopeCode))
46-
&& $scopeType !== ScopeConfigInterface::SCOPE_TYPE_DEFAULT
47-
) {
46+
47+
if ($scopeType !== ScopeConfigInterface::SCOPE_TYPE_DEFAULT) {
4848
$scopeResolver = $this->scopeResolverPool->get($scopeType);
4949
$resolverScopeCode = $scopeResolver->getScope($scopeCode);
5050
} else {
5151
$resolverScopeCode = $scopeCode;
5252
}
5353

54-
if ($resolverScopeCode instanceof \Magento\Framework\App\ScopeInterface) {
54+
if ($resolverScopeCode instanceof ScopeInterface) {
5555
$resolverScopeCode = $resolverScopeCode->getCode();
5656
}
5757

58+
if ($scopeCode === null) {
59+
$scopeCode = $resolverScopeCode;
60+
}
61+
5862
$this->resolvedScopeCodes[$scopeType][$scopeCode] = $resolverScopeCode;
63+
5964
return $resolverScopeCode;
6065
}
6166

0 commit comments

Comments
 (0)