Jump to content


  • Posts

  • Joined

  • Last visited


Profile Information

  • Activity

gr4devel's Achievements


Newbie (1/14)




Community Answers

  1. How I'm supposed to set the selected options for a multiple select input type inside an HelperForm? Here's the code that should handle the display of the over mentioned select input type: ... array( 'type' => 'select', 'name' => 'field_name[]', 'id' => 'field_name', 'label' => $this->l('Multiple value select field'), 'desc' => $this->l('...'), 'multiple' => true, 'options' => array( 'query' => $field_values, 'id' => 'id_field_value', 'name' => 'field_value_name' ) ), ... Just for the record, the trailing square brackets after the input type name are needed to properly populate the POST variable with all the multiple value selected. Here's the code that should handle the correct selection of the already saved (i.e. selected) options: ... $helper->tpl_vars = array( 'uri' => $this->getPathUri(), 'fields_value' => [ ... 'field_values[]' => $field_values, ... ], 'languages' => $this->context->controller->getLanguages(), 'id_language' => $current_back_office_language ); ... As always there is no clear documentation that clarifies how to structure the $field_values field. I've tried a bunch of different options like a plain array of indexes or an hash with each index identified by the actual name (i.e. string) but nothing seems to work. Every help will be appreciated. Thanks.
  2. Ok, the problem could be related to the name give to the select input type. It needs to be something like: array( 'type' => 'select', 'name' => 'your_name[]', 'multiple' => true, ..., 'options' => array( ... ) ) Beware of the square brackets for the select input type name [] . They aren't automatically added by the `'multiple' => true` directive! But actually I think they should. I hope I solved the problem, @NishantVadgama if so go on and mark the topic as solved
  3. Two persons with the same problem and still not an answer... Let's see if the number gets to three changes something... Btw these damned Helpers are really difficult to use (and buggy?) and there is really no documentation at all...(please don't link me the PS doc about them because for me that is definitely not a doc!)
  4. Hi community. I'm trying to get the values of two multilanguage fields submitted through a form generated by an HelperForm. However I can't find an already prepared utility function for that. I mean, if I check the $_POST variable I find that all the multilanguage fields are identified by their names with the language id appended at the end. e.g.: array(9) { ["submitmymodule"]=> string(1) "1" ["filename"]=> string(0) "" ["combination"]=> string(2) "12" ["description_1"]=> string(11) " hi " ["description_2"]=> string(12) " there " ["description_short_1"]=> string(11) " hi " ["description_short_2"]=> string(12) " there " ["save"]=> string(1) "1" ["tab"]=> string(12) "AdminModules" } Am I really supposed to handle the fields myself by grouping them based on the languages? Isn't there an already prepared PS utility for that?
  5. Ok, I found the solution. To accomplish what I need you should not bind multiple actions to the same Form Helper but simply specify a different name for each different submit input type defined for the Helper. I wasn't clear enough don't hesitate to ask for clarifications. Cheers!
  6. Thanks PhpMadman, the point is to have the same form (and related Helper) that can handle different type of submission. In this way you only have one Helper with all the related initialization configurations. My question raised from the fact that, without the possibility to have multiple submit actions "attached" to the same form, it would be necessary to instantiate multiple forms and so multiple Helpers that would have all the same configurations except for the submit action. Moreover my question came up by looking at the possibility to have different fieldsets for each helper. I hope I was clear enough. If this is not the case don't hesitate to ask Cheers.
  7. 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.
  8. Hi community. Today I'm trying to figuring out if it is possible to have ONE Helper Form that handles multiple submit actions. I know that already someone on the forum had the same need but didn't get any help. I hope I'll be more lucky. Thanks in advance. Cheers.
  9. Thanks for your support PhpMadman Actually I was trying to create a new class extending the ObjectModel that could handle a few multilanguage fields. Anyway I don't know how to initialize the tables underlying this new class ObjectModel
  10. Hi community. Does anyone knows how can I handle multilanguages fields of a custom Model (i.e. custom class that extends the PS ObjectModel). I mean, I know how to declare the Model but am I supposed to create a separate table for the translations or does it gets created "automagically" by the framework? Thanks in advance to everyone one Cheers!
  11. 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...
  12. 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?
  13. I think the first file chooser should be hided...but why it is not? Am I missing some config value for the input?
  14. 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);
  15. Ok you're rigth buddy I need to be more precise The hook I'm using for the module is hookDisplayAdminOrder. Basically I'm displaying a table with some actions. I don't want to handle these actions via Ajax and so I was thinking to call directly the methods related to the actions. BTW, if I wasn't clear or if there is the need of some more info just ask me P.S: thank you as always for your disposability
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More