Search code examples
phphelperprestashop-1.6

How to use HelperForm from the FrontController in PrestaShop 1.6


I was trying to do a form with the helperForm, but it was imposible. I was following the official documentation, but was imposible for me from the FrontControler.

http://doc.prestashop.com/display/PS16/Using+the+HelperForm+class

Can i do that??

The error that show to me is:

Uncaught --> Smarty: Unable to load template file 'helpers/form/form.tpl'

And my class is:

public function renderForm()
  { 
    $fields_form = array( 'form' => array(
      'legend' => array(       
        'title' => $this->module->l('Edit carrier'),       
        'image' => '../img/admin/icon_to_display.gif'   
      ),   
      'input' => array(       
        array(           
          'type' => 'text',
          'name' => 'shipping_method',
         ),
      ),
      'submit' => array(
        'title' => $this->module->l('Save'),       
        'class' => 'btn btn-default pull-right'   
      )
    ));

    $helper = new HelperForm();
    $helper->show_toolbar = false;
    $helper->table = $this->table;
    $this->fields_form = array();

    $helper->identifier = $this->identifier;
    $helper->submit_action = 'submitBlockCart';

    return $helper->generateForm(array($fields_form));
}

I'm going crazy....


Solution

  • The answer is simple: You CAN NOT use HelperForm from the FrontEnd.

    As far as I know you can use the helperForm only in the BackOffice, so I don't think you can in the front.