Skip to main content

How to edit the settings in Opencart 2.x (php)




IMPORTANT NOTE: editSetting() will Delete ALL the previous settings. Usually in opercart it's used in the configuration page to get all the data in one "post" request.

This sample is for the module 'accountdisabler' - replace 'accountdisabler' with your own module name. Also the key string (ex. 'accountautodisabler_days' ) must start with your module name.


//Loading the model
$this->load->model('setting/setting');
//setting data for our module
$aadata = array('accountautodisabler_days' => '60');
//editing
$this->model_setting_setting->editSetting('accountautodisabler', $aadata);

In this example it saves data for the main/first store ( with id 0 ).


 An example to store multiple multiple values that are serialized in the database

//Loading the model
$this->load->model('setting/setting');
//setting data for our module
$aadata = array('accountautodisabler_days' => '60',
                          'accountautodisabler_mymixeddata' => array( 'value1', 'value2')
                         );
//editing
$this->model_setting_setting->editSetting('accountautodisabler', $aadata);



Comments

Popular posts from this blog

Moodle 3.8.1+ - path leak via errors in several files

Moodle 3.8.1+ ----------------------------------------------- File: admin/mailout-debugger.php #!/usr/bin/php Notice : Disabled. in \admin\mailout-debugger.php on line 73 File: admin/settings/appearance.php Notice : Undefined variable: hassiteconfig in \admin\settings\appearance.php on line 10 Fatal error : Uncaught Error: Call to undefined function has_any_capability() in \admin\settings\appearance.php:10 Stack trace: #0 {main} thrown in \admin\settings\appearance.php on line 10 File: admin/settings/badges.php Notice : Undefined variable: hassiteconfig in \admin\settings\badges.php on line 30 Fatal error : Uncaught Error: Call to undefined function has_any_capability() in \admin\settings\badges.php:30 Stack trace: #0 {main} thrown in \admin\settings\badges.php on line 30 File: admin/settings/courses.php Notice : Undefined variable: hassiteconfig in \admin\settings\courses.php on line 32 Fatal error : Uncaught Error: Call to undefined function

2022 - Remove (the too many) Ads from Memu launcher

Simple method Download from pureapk "MEmu Launcher2" ex: MEmu Launcher2_v6.0.9_apkpure.com Install "System app remover" (root) remove from system apps the "memu launcher 2" import the "purified" MEmu Launcher2 apk with the Memu utility ("apk" on the right toolbar) Longer method Install "Export Apk" Export the memu launcher2  Install purify https://github.com/echo-devim/purify/raw/master/Purify.apk use purify with the exported memu launcher 2 Install "System app remover" (root) remove from system apps the "memu launcher 2" import the "purified" MEmu Launcher2 apk with the Memu utility ("apk" on the right toolbar)