kelvindereus Posted December 31, 2022 Share Posted December 31, 2022 Hy, i have the following code in my addon to make a switch at the config page: [ "type" => "switch", "label" => $this->l("contact form notification"), "name" => "SWITCH_CONTACT_FORM", "reverse" => false, "choices" => [ "ON" => true, "OFF" => false, ], ], Now the issue is: Switch on = No, switch off is Yes. I tryd switching (Ha gotem) the boolean value (ON => false, OFF = true) but that has no effect. Link to comment Share on other sites More sharing options...
Daresh Posted December 31, 2022 Share Posted December 31, 2022 How did you come out with a code like this? Check out some native module to see how switches are made. For example: ps_featuredproducts. Link to comment Share on other sites More sharing options...
kelvindereus Posted December 31, 2022 Author Share Posted December 31, 2022 Here is the code i found. But i will look into ps_featuredproducts! Link to comment Share on other sites More sharing options...
idnovate.com Posted January 3, 2023 Share Posted January 3, 2023 Try this: array( 'type' => 'switch', 'label' => $this->l('Field label'), 'name' => 'CONFIG_VAR', 'is_bool' => true, 'values' => array( array( 'id' => 1, 'value' => 1, 'label' => $this->l('Yes') ), array( 'id' => 0, 'value' => 0, 'label' => $this->l('No') ), ) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now