Jump to content

Problem with helperForm override


Nicola

Recommended Posts

Hi folks,

I'm creating a module on my prestashop (Version 1.6). On the module, I create a custom admin tab for my backend. I associated the tab with an admin controller. In this admin controller, I want to create a list to show my record on DB, and a form in order to add new record or to edit the records I created previously.

I'm trying to create the form part using the helperForm. I have a problem when trying to override the form.tpl (I get no form, just the admin page of prestashop with only the title of the list). I didn't find nothing in the Prestashop Docs which can explain me how to override the form in the helperForm

 

$fields_form = array(
	'form' => array(
    	'legend' => array('title' => $this->l('Add / Edit code')),
        'input' => array(  
        	array('type' => 'text', 'label' => $this->l('Code'), 'required' => true, 'name' => 'code'),
            array('type' => 'hidden', 'name' => 'active'),
        ),
        'submit' => array('title' => $this->l('Save'))
     )
);

$helper = new HelperForm();
        
$helper->generateForm(array($fields_form));

what I need to add to the $helper object in order to show me the overrided form?!

 

Link to comment
Share on other sites

On 1/5/2018 at 3:14 AM, jgamio said:

I will recommend you take a look on the admin Controllers of PRestashop everything you need is there

 

take some simple AdminCountriesController and check the renderForm part

 

Hey, thanks for the reply. I checked but AdminCountriesController not use helperForm, but it just returns the parent renderForm. I need to use the hlperForm in order to change the normal form layout adding a new field where show the image uploaded.

Link to comment
Share on other sites

Again you need check the core code

i dont understand why you need use the helpForm for these

check AdminCategoriesController.php where you see handle a picture

 

Usually you use the helpForm on the configuration ( Maybe not 100% true I do in these way) screen but for regular Controller you should use the standard each screen on the backoffice use almost the same base code

 

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...