Jump to content

AdminPPreferences not load custom form


JavierEsK

Recommended Posts

Hi, I'm triying to add a new option in the formulary of AdminPPreferences:

Steps: 

 

Loading of data

$optionsol = array();

foreach ($result as $ley => $product)

{

 $optionsol[] = array(

    "id" => (int)$product['id_product'],

    "name" => $product['name']

 );

}

Which returns correctly the next array:

Array

(

    [0] => Array

        (

            [id] => 100

            [name] => Ejemplo 1

        )

    [1] => Array

        (

            [id] => 101

            [name] => Ejemplo 2

        )

)

 

But, here's the problem, when i call to this form:

 

'PS_PRODUCT_LIST_GIFT' => array(

'title' =>  $this->l('List products of gift.'),

'type' => 'checkbox',

'name' => 'gifts',

//'multiple' => true,

'values' => $optionsol,

),

 

Only load the message:

"List products of gift" and anything more, i try to use the documentation of prestashop, but not working. Also i have used a select (multiple) but anything works.

Only that the admin show me is a select (simple) :(

 

Someone knows what's the problem?

 

Regards.

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

This is the solution in a part.

Note: Select multiple is not possible here (in administration > helper folder > options.tpl)

 

'PS_PRODUCT_LIST_GIFT' => array(
'type' => 'checkbox',
'title' =>  $this->l('List products of gift.'),
'hint' => $this->l('Select the products of gift.'),
'name' => 'gifts[]',
'class' => 'groupBox',
'lang' => true,
'choices' => $optionsol,
),
 
Now the problem is that if i show the $_POST var, PS_PRODUCT_LIST_GIFT always has one value.
 
Someone knows how i can to take alls values?
 
Regards.
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...