diff --git a/CHANGELOG.md b/CHANGELOG.md index d71279e1c4..8085af9999 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Fixed a bug where variant prices could display incorrectly when inline editing. ([#3768](https://github.com/craftcms/commerce/issues/3768)) - Fixed a performance degradation bug with variant queries. ([#3758](https://github.com/craftcms/commerce/issues/3758)) +- Fixed a PHP error that could occur when managing store settings. ([#3780](https://github.com/craftcms/commerce/issues/3780)) ## 5.2.5 - 2024-11-20 diff --git a/src/controllers/BaseStoreManagementController.php b/src/controllers/BaseStoreManagementController.php index f0185773a4..c713f5211e 100644 --- a/src/controllers/BaseStoreManagementController.php +++ b/src/controllers/BaseStoreManagementController.php @@ -40,6 +40,16 @@ public function init(): void public function renderTemplate(string $template, array $variables = [], ?string $templateMode = null): YiiResponse { $variables['storeSettingsNav'] = $this->getStoreSettingsNav(); + + if (!isset($variables['storeHandle'])) { + $routeParams = Craft::$app->getUrlManager()->getRouteParams(); + + // Make sure store handle is always passed to the template + if (isset($routeParams['storeHandle'])) { + $variables['storeHandle'] = $routeParams['storeHandle']; + } + } + return parent::renderTemplate($template, $variables, $templateMode); }