Skip to content

Commit

Permalink
saving settings amend
Browse files Browse the repository at this point in the history
  • Loading branch information
i-just committed Apr 25, 2024
1 parent 19b37f8 commit 053f0a1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/controllers/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/templates/settings/_products.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 053f0a1

Please sign in to comment.