manisharora Posted January 22, 2017 Share Posted January 22, 2017 (edited) Hi, How can I set the value of the radio input added through $this->fields_form_override. public function renderForm() { $this->fields_form_override = array( array( 'type' => 'switch', 'label' => $this->l('Enable Product Customizer'), 'name' => 'enable_product_customizer', 'required' => false, 'is_bool' => true, 'values' => array( array( 'id' => 'enable_product_customizer_on', 'value' => 1, 'label' => $this->l('Enabled') ), array( 'id' => 'enable_product_customizer_off', 'value' => 0, 'label' => $this->l('Disabled') ) ) ) ); return parent::renderForm(); } I tried adding it through $this->fields_value, but it doesn't work because this variable is overwritten when calling parent::renderForm(). Edited January 22, 2017 by twicekilled (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted January 23, 2017 Share Posted January 23, 2017 The fields values should merge in the parent, if not it's simply because of the bad architecture of the original controller. In this case, I would just clone the whole method and call the grandparent at the end Link to comment Share on other sites More sharing options...
manisharora Posted January 23, 2017 Author Share Posted January 23, 2017 (edited) fields_value didn't work because it was getting reset in the original controller here $this->fields_value = array( 'image' => $image ? $image : false, 'size' => $image ? filesize(_PS_CAT_IMG_DIR_.'/'.$obj->id.'.'.$this->imageType) / 1000 : false ); But cloning the whole renderForm method and returning AdminController::renderForm() at the end worked perfectly. Thanks, NemoPS. Edited January 23, 2017 by twicekilled (see edit history) 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