Jump to content

Edit History

bav_it

bav_it

Have you solved it?

 

Later edit:

Found the issue!

All values from this form must be declared in a key like this fields_value. Look here for example:

$form = [
                'form' => [
                    'legend' => [
                        'title' =>  'Adaugare oferta',
                    ],
                    'input' => [
                        [
                            'name' => 'bav_title',
                            'type' => 'text',
                            'label' => $this->l('Titlu'),
                            'size' => 500,
                            'required' => true,
                        ],
                        [
                            'name' => 'bav_image',
                            'type' => 'file',
                            'label' => $this->l('Imagine'),
                            'required' => true,
                            'value' => ''
                        ],
                        [
                            'name' => 'bav_subtitle_row_1',
                            'type' => 'text',
                            'label' => $this->l('Subtitlu 1 (bold)'),
                            'value' => '',
                            'size' => 500,
                        ],
                        [
                            'name' => 'bav_subtitle_row_2',
                            'type' => 'text',
                            'label' => $this->l('Subtitlu 2'),
                            'size' => 500,
                        ],
                        [
                            'name' => 'bav_description',
                            'type' => 'textarea',
                            'label' => $this->l('Descriere'),
                            'size' => 5000,
                        ],
                        [
                            'name' => 'bav_product_link',
                            'type' => 'text',
                            'label' => $this->l('Link produs'),
                            'size' => 2000,
                        ],
                        [
                            'name' => 'bav_sort_order',
                            'type' => 'text',
                            'label' => $this->l('Ordine sortare'),
                            'size' => 10,
                        ],
                        [
                            'name' => 'bav_is_visible',
                            'type' => 'select',
                            'label' => $this->l('Este vizibil'),
                            'options' => ['1' => 'Da', '0' => 'Nu'],
                        ],
                        [
                            'name' => 'bav_start_on',
                            'type' => 'date',
                            'label' => $this->l('Oferta incepe pe'),
                        ],
                        [
                            'name' => 'bav_expires_on',
                            'type' => 'date',
                            'label' => $this->l('Oferta expira pe'),
                        ],
                    ],
                    'fields_value' => [
                        // fixes undefined notices in smarty (is looking here to fill form with values)
                        'bav_title' => '',
                        'bav_image' => '',
                        'bav_subtitle_row_1' => '',
                        'bav_subtitle_row_2' => '',
                        'bav_description' => '',
                        'bav_product_link' => '',
                        'bav_sort_order' => '0',
                        'bav_is_visible' => '1',
                        'bav_start_on' => '',
                        'bav_expires_on' => '',
                    ],
                    'submit' => [
                        'title' => 'Adauga',//$this->l('Save'),
                        'class' => 'btn btn-default pull-right',
                    ],
                ]
            ];

 

I know this answer may not help you as two years passed, but it may help others.

bav_it

bav_it

Have you solved it?

 

Later edit:

Found the issue!

All values from this form must exist in configuration table specific for that module. Even if you don't use them inside Configuration, they must be declared.

My sollution was to declare all these fields in install() function of module, and use the values stored in my custom database table. My module was using a custom table and I didn't want to store unnecesaryy stuff in ps_configure table.

 

This values can be added in install() function of developed module to FIX undefined notices. To BYPASS them, just disable DEBUG MODE, however a good programing practice is to treat all errors..

Configuration::updateValue('name_of_input_in_form', 'value');

 

Other methods are:

Configuration::getValue('name_of_input_in_form')

Configuration::deleteByName('name_of_input_in_form')

 

I know this answer may not help you as two years passed, but it may help others.

bav_it

bav_it

Have you solved it?

 

Later edit:

Found the issue!

All values from this form must exist in configuration table specific for that module. Even if you don't use them inside Configuration, they must be declared.

My sollution was to declare all these fields in install() function of module, and use the values stored in my custom database table. My module was using a custom table and I didn't want to store unnecesaryy stuff in ps_configure table.

 

This values can be added in install() function of developed module to FIX undefined notices. To BYPASS them, just disable DEBUG MODE, however a good programing practice is to treat all errors..

Configuration::setValue('name_of_input_in_form', 'value');

 

Other methods are:

Configuration::getValue('name_of_input_in_form')

Configuration::updateValue('name_of_input_in_form', 'value');

Configuration::deleteByName('name_of_input_in_form')

 

I know this answer may not help you as two years passed, but it may help others.

bav_it

bav_it

What was the problem? I am stuck in the same place as you. Thanks! 

×
×
  • Create New...