Post by Joe1234 » Wed Jul 24, 2024 9:21 pm

I'm doing my first mod with an admin page and using the settings table in the database. I want to change the code name for my settings, but once I change it the settings are no longer saving until I change it back.

Ex. I have it working like:

Code: Select all

		if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
			$this->model_setting_setting->editSetting('site_guard_srl', $this->request->post);
		}
		
		if (isset($this->request->post['site_guard_rl_customer_exempt'])) {
			$data['site_guard_rl_customer_exempt'] = $this->request->post['site_guard_rl_customer_exempt'];
		} else {
			$data['site_guard_rl_customer_exempt'] = $this->config->get('site_guard_rl_customer_exempt');
		}
When I change "site_guard_srl" to "site_guard_hrl", or anything else, it stops saving,. When I change it back everything works again. If I manually delete all "site_guard_srl" code rows in the database and then try to save again with "site_guard_hrl" it still wont work.

THERE ARE NO OTHER CHANGES.

Any idea?

Also note:
I also tried changing the names of the key names (both with the new and old code name), and when I do that the things no longer save as well.
Last edited by Joe1234 on Thu Jul 25, 2024 5:23 am, edited 2 times in total.

v3.0.4.0 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.


Active Member

Posts

Joined
Sat Jan 01, 2022 5:47 am

Post by nonnedelectari » Wed Jul 24, 2024 9:43 pm

Joe1234 wrote:
Wed Jul 24, 2024 9:21 pm
I'm doing my first mod with an admin page and using the settings table in the database. I want to change the code name for my settings, but once I change it the settings are no longer saving until I change it back.

Ex. I have it working like:

Code: Select all

		if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
			$this->model_setting_setting->editSetting('site_guard_srl', $this->request->post);
		}
When I change "site_guard_srl" to "site_guard_hrl", or anything else, it stops saving,. When I change it back everything works again. If I manually delete all "site_guard_srl" code rows in the database and then try to save again with "site_guard_hrl" it still wont work.

THERE ARE NO OTHER CHANGES.

Any idea?

Also note:
I also tried changing the names of the key names (both with the new and old code name), and when I do that the things no longer save as well.
depends on what you are posting.

Active Member

Posts

Joined
Thu Mar 04, 2021 6:34 pm

Post by Joe1234 » Wed Jul 24, 2024 9:45 pm

nonnedelectari wrote:
Wed Jul 24, 2024 9:43 pm
depends on what you are posting.
I edited the OP while you were posting.

v3.0.4.0 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.


Active Member

Posts

Joined
Sat Jan 01, 2022 5:47 am

Post by grgr » Wed Jul 24, 2024 9:56 pm

For example, If you look at the settings.php controller, the code is "config"

If you look at the settings.twig template you will see all the settings begin with "config"

The two have to match.

-
Image Image Image
VIEW ALL EXTENSIONS * EXTENSION SUPPORT * WEBSITE * CUSTOM REQUESTS


User avatar
Active Member

Posts

Joined
Mon Mar 28, 2011 4:08 pm
Location - UK

Post by Joe1234 » Wed Jul 24, 2024 10:15 pm

@grgr, mine already does match..."site_guard".

v3.0.4.0 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.


Active Member

Posts

Joined
Sat Jan 01, 2022 5:47 am

Post by nonnedelectari » Wed Jul 24, 2024 11:41 pm

Joe1234 wrote:
Wed Jul 24, 2024 9:45 pm
nonnedelectari wrote:
Wed Jul 24, 2024 9:43 pm
depends on what you are posting.
I edited the OP while you were posting.
If you use

Code: Select all

$this->model_setting_setting->editSetting('site_guard_srl', $this->request->post);
your post key variable should start with

Code: Select all

site_guard_srl
in other words. $this->model_setting_setting->editSetting() does not allow you to change the code, just its value.

Active Member

Posts

Joined
Thu Mar 04, 2021 6:34 pm

Post by Joe1234 » Thu Jul 25, 2024 5:23 am

Ahhh I see, thanks both of you.

v3.0.4.0 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.


Active Member

Posts

Joined
Sat Jan 01, 2022 5:47 am
Who is online

Users browsing this forum: Semrush [Bot] and 18 guests