Jump to content

HelperForm for Prestashop 1.4


Recommended Posts

I have developed a module for Prestashop 1.5 which used HelperForm. However, HelperForm is not available in PrestaShop 1.4. What should I use so that it is compatible both Prestashop 1.4 and 1.5?

 

Thanks in Advance.

Link to comment
Share on other sites

You can use an if statement to check the current PS_VERSION, and include your own library of helperform (that you create, or clone from 1.5) to use in that case ;)

 

Or, always using the if statement, hardcode what you used the helper form for

Link to comment
Share on other sites

  • 2 years later...

if (version_compare(_PS_VERSION_, '1.5', '<') {

// the 1.4 part

} else {

// the helper form

}

 

I appreciate your help and that's the very easy part.

 

The hard part is figuring out how to make it work. :P

 

I mean, I've tried to import HelperForm.php from 1.5 and other files as well but I couldn't make it work so I suppose there are other ways of doing it in 1.4 which are totally different from 1.5 and 1.6.

 

This is my helperform by the way, how could I convert this to 1.4?

$helper = new HelperForm();
        $helper->show_toolbar = true;        // false -> remove toolbar
        $helper->toolbar_scroll = true;      // yes - > Toolbar is always visible on the top of the screen.
        $helper->toolbar_btn = array(
            'save' =>
            array(
                'desc' => $this->l('Save'),
                'href' => AdminController::$currentIndex.'&configure='.$this->name.'&save'.$this->name.
                '&token='.Tools::getAdminTokenLite('AdminModules'),
            ),
            'back' => array(
                'href' => AdminController::$currentIndex.'&token='.Tools::getAdminTokenLite('AdminModules'),
                'desc' => $this->l('Back to list')
           )
        );
        $helper->table = $this->table;
        $helper->name_controller = $this->name;
        $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
        $helper->default_form_language = $lang->id;
        $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
        $helper->identifier = $this->identifier;
        $helper->override_folder = '/';
        $helper->module = $this;
        $helper->submit_action = 'submitRemarketingEmailsSms';
        $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
        $helper->token = Tools::getAdminTokenLite('AdminModules');
        $helper->tpl_vars = array(
            'fields_value' => $this->getConfigFieldsValues(),
            'languages' => $this->context->controller->getLanguages(),
            'id_language' => $this->context->language->id
        );

        return $helper->generateForm(array(
            $fields_form_1,
            $fields_form_2,
            $fields_form_3,
            $fields_form_4,
            $fields_form_5,
            $fields_form_6,
            $fields_form_7,
            $fields_form_8,
            $fields_form_9,
            $fields_form_10,
            $fields_form_11,
            $fields_form_12,
            $fields_form_13
        ));

Thanks a lot in advance.

Link to comment
Share on other sites

Ah, you can't. You have to build the form manually in 1.4, otherwise you have to invent you own. That's how it used to work, manually writing each div and element

 

 

prestashop 1.4 does not have any kind of helper :)

 

Thank you both for your inputs.

 

Ok, so that means a lot of work and I will probably simply put this uncompatible with v1.4

 

1.4 market isn't that big, right?

Link to comment
Share on other sites

×
×
  • Create New...