gr4devel Posted September 8, 2014 Share Posted September 8, 2014 (edited) Hi community. I'm wondering why I get the result of the attached image with the following code: $default_lang = (int)Configuration::get('PS_LANG_DEFAULT'); $fields_form[0]['form'] = array( 'legend' => array( 'title' => $this->l('Import combinations'), 'image' => '../img/admin/cog.gif' ), 'input' => array( array( 'type' => 'file', 'name' => 'my-name', 'multiple' => true, 'label' => $this->l('Choose combinations file'), 'desc' => $this->l('Terms display on the top of the form.'), 'lang' => true, 'id' => 'my-name' ) ), 'submit' => array( 'title' => $this->l('Import'), 'class' => 'button' ) ); $helper = new HelperForm(); $helper->module = $this; $helper->name_controller = $this->name; $helper->token = Tools::getAdminTokenLite('AdminModules'); $helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name; $helper->languages = Language::getLanguages(); $helper->default_form_language = $default_lang; $helper->allow_employee_form_lang = $default_lang; $helper->title = $this->displayName; $helper->show_toolbar = true; $helper->toolbar_scroll = true; $helper->submit_action = 'submit'.$this->name; $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->fields_value['BETTERPRICE_EMAIL'] = Configuration::get('BETTERPRICE_EMAIL'); return $helper->generateForm($fields_form); Edited September 10, 2014 by gr4devel (see edit history) Link to comment Share on other sites More sharing options...
gr4devel Posted September 8, 2014 Author Share Posted September 8, 2014 I think the first file chooser should be hided...but why it is not? Am I missing some config value for the input? Link to comment Share on other sites More sharing options...
loulou66 Posted September 8, 2014 Share Posted September 8, 2014 Hi see the module Blocktopbanner in php for the formhelper and in \views\templates\admin\_configure\helpers\form for extend the tpl @++ Loulou66 Link to comment Share on other sites More sharing options...
gr4devel Posted September 8, 2014 Author Share Posted September 8, 2014 Thank you for the quick response but I'm curious, is it an actual (and known) problem of the default template used to display the file input field? Link to comment Share on other sites More sharing options...
loulou66 Posted September 8, 2014 Share Posted September 8, 2014 Hi i see you use 'multiple'=>true; i fdont see this in DOC and in Form.tpl the multiple is for type=select @++ loulou66 Link to comment Share on other sites More sharing options...
gr4devel Posted September 9, 2014 Author Share Posted September 9, 2014 If you check inside the simple.tpl (admin/themes/default/template/helpers/uploader/simple.tpl) you can see that a smarty variable $multiple is actually used... Anyway I can't find any official DOC about the file input type and so I'm currently working blindly... Sincerely I don't want to try to figure it out how the field works by manually checking the view and the controller code... A framework like PS (at its version) should have a proper documentation about its functionality... Link to comment Share on other sites More sharing options...
gr4devel Posted September 10, 2014 Author Share Posted September 10, 2014 (edited) Ok the problem here was related to the fact that the module I was creating didn't was "bootstraped". Take a look here: http://doc.prestashop.com/display/PS16/Making+your+module+work+with+Bootstrap TL;DR: just add $this->bootstrap = true; to your module constructor and the problem should be fixed. Edited September 10, 2014 by gr4devel (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now