Jump to content

[solved] Select box for a module


lamiax

Recommended Posts

Hello,

 

I need for a module, on the back office, to create a select box to to display a list.

 

My code is that :

array(
					'type' => 'select',
					'label' => $this->l('Select the group'),
					'name' => 'id_default_group',
					'options' => array(
						'query' => 'test',
						'id' => 'id_category_parent',
						'name' => 'name'
					),
					'desc' => ("Default, groupe is Home")
					),

 

But i don't understant how i can insert my options...

So i need help.

THank's you ! =)

Link to comment
Share on other sites

In part

 

        'options' => array(
               'query' => 'test',
               'id' => 'id_category_parent',
               'name' => 'name'
       ),

instead of 'test' there should be some array which you probably get from database.

But for example here is hard-coded

  $optionsforselect = array(
array('id_category_parent' => '1','name' => 'Home' ),
array('id_category_parent' => '2','name' => 'Ipods' ),
array('id_category_parent' => '3','name' => 'Laptop' )
);

And the you can use

 

        'options' => array(
               'query' =>  $optionsforselect,
               'id' => 'id_category_parent',
               'name' => 'name'
       ),

Edited by razaro (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...