zebenplexus Posted February 25, 2019 Share Posted February 25, 2019 (edited) Anybody know how to create a select with optgroup in function renderForm() and $this->fields_form? I have a multiple select, and i need create section in select to split products (split by store or category): $this->fields_form = array( 'tinymce' => true, 'legend' => array('title' => $this->l('Page')), 'input' => array( array( 'type' => 'text', 'label' => $this->l('Name'), 'name' => 'name', 'lang' => true, 'required' => true, 'hint' => $this->l('Invalid characters:').' <>;=#{}', ), array( 'type' => 'select', 'label' => $this->l('Products'), 'name' => 'id_products[]', 'required' => false, 'col' => '4', 'default_value' => null, 'multiple' => true, 'options' => array( 'query' => Product::getProducts($this->context->language->id, 0, 6000, 'name', 'asc'), 'id' => 'id_product', 'name' => 'name' ) ) ), 'submit' => array('title' => $this->l('Save')) ); Thanks for help. Edited March 1, 2019 by zebenplexus (see edit history) Link to comment Share on other sites More sharing options...
ghazaal Posted April 10, 2019 Share Posted April 10, 2019 'input' => array( array( 'type' => 'select', 'label' => 'select product one', 'name' => 'type_select_chosen', 'class' => 'chosen', 'options' => array( 'optiongroup'=>array( 'label'=>'label', 'query'=>array(array( 'label'=>'marg', 'options'=>array( array('id'=>1,'name'=>'one'), array('id'=>2,'name'=>'two'), array('id'=>3,'name'=>'three')) )), ), 'options'=>array( 'query'=>'options', 'id'=>'id', 'name'=>'name' ) ), ), ), 1 Link to comment Share on other sites More sharing options...
lephot Posted April 12, 2020 Share Posted April 12, 2020 Hi, I know this post is not very young, but... Do you know if this works in Prestashop 1.7.6.4 ? I need to do exactly the same thing, but I have no idea how to do this and where to put it ? thanks for the feed back ! 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