Jump to content

Edit History

zebenplexus

zebenplexus

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.

zebenplexus

zebenplexus

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.

×
×
  • Create New...