From 053f0a1d116aabe78920112efc4bd7f040154c10 Mon Sep 17 00:00:00 2001 From: Iwona Just Date: Thu, 25 Apr 2024 12:32:26 +0100 Subject: [PATCH] saving settings amend --- src/controllers/SettingsController.php | 8 ++++---- src/templates/settings/_products.twig | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/controllers/SettingsController.php b/src/controllers/SettingsController.php index deee75f..c64f1db 100644 --- a/src/controllers/SettingsController.php +++ b/src/controllers/SettingsController.php @@ -65,21 +65,21 @@ public function actionIndex(?Settings $settings = null): Response public function actionSaveSettings(): ?Response { $settings = Craft::$app->getRequest()->getParam('settings'); + $routingSettings = Craft::$app->getRequest()->getParam('routingSettings'); $plugin = Plugin::getInstance(); /** @var Settings $pluginSettings */ $pluginSettings = $plugin->getSettings(); - if (isset($settings['routing'])) { + if (isset($routingSettings['routing'])) { $originalUriFormat = $pluginSettings->productUriFormat; // Remove from editable table namespace - $settings['productUriFormat'] = $settings['routing']['productUriFormat']; + $settings['productUriFormat'] = $routingSettings['routing']['productUriFormat']; // Could be blank if in headless mode if (isset($settings['routing']['productTemplate'])) { - $settings['productTemplate'] = $settings['routing']['productTemplate']; + $settings['productTemplate'] = $routingSettings['routing']['productTemplate']; } - unset($settings['routing']); } $settingsSuccess = true; diff --git a/src/templates/settings/_products.twig b/src/templates/settings/_products.twig index 8da6bd1..68e31a0 100644 --- a/src/templates/settings/_products.twig +++ b/src/templates/settings/_products.twig @@ -4,7 +4,7 @@ label: "Routing Settings"|t('stripe'), instructions: "Configure the product’s front-end routing settings."|t('stripe'), id: 'routing', - name: 'settings', + name: 'routingSettings', cols: { productUriFormat: { type: 'singleline',