Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by gr4devel

  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
  16. Hi community! Today I'm facing the problem to call some methods of a module I've created that hooks itself in the order detail page of the BO. Should I create a proper AdminController specific for the module? If yes how can I call the methods I need from the template that the module display in the order detail page? BTW, I've tried to follow the documentation but I only found information related to the Front Office Controllers.
  17. Ok I solved alone the problem. It was related to the option of the order state. Rule: if there is one order state in the order state history of the order with the "Show delivery PDF" checked then the order can't be modified. As concept it's pretty consistent but I think that the doc could be improved mentioning this situation.
  18. Hi community I'm facing a big problem After change the orders state I can't modify them (e.g. remove products or edit their quantities). I tried to restore the previous state but nothing changed. Help
  19. Here I am!!! I'm sorry for my incredible late response! Anyway thank you very much for your support selectshop.at ! And obviously to you El Patron!!! At the end the problem was right what you El Patron suggested! I was querying the wrong table so there's no strange behavior regarding the SQL Manager. I'm really sorry for having raised so much rumor about the SQL Manager, I hope it will never happen again! Btw thanks to everybody!
  20. Thank you very much buddy I really appreciate your suggestion However I'm trying to relying on it to extract some information from the DB. Actually I don't want to develop a module only to execute a query and display the results in the BO. I hope that some moderators or some more experienced devs will help us!
  21. Hi community... I sincerely hope that someone will help me this time. The lasts posts that I've written here didn't get much attention... Today I'm facing the inconsistent behavior of the SQL manager with the rest of the PS platform. More specifically: if I write a query the result isn't aligned with the actual state of the db. For example I don't get the correct quantity for the products! Is there some caching behind? Or is it a bug? Please help me.
  22. Dear all I have an urgent problem. In P.S when I try to update an address from the customer back end in the FO I get an error regarding the empty vat_number. I modified the template and add an Address override to enable the company field requirement together with the dni and the over mentioned vat_number. The problem is that when there is the Address update, its fields appear totally blank. Please help me is quite urgent
  23. Community? Didn't I explain myself clearly? If so, and if anyone is interested in this question, please write me . Btw: I've already implemented a method to automatically choose the new added address in the OPC checkout as the invoice or delivery address when returned from the address addition. However I've modified not only the theme but also the core AddressController, in which there's the possibility to automatically choose only the invoice address. I'm planning to ask a pull request on github but before I want to be sure that there's no better method to accomplish what I (and maybe other) need.
  24. Hi community, a very specific question today Is there a proper way (by not touching the core PS files!) to automatically set the new added address during the OPC as the delivery one instead of the invoice one? I've found that in the address controller there's a check that set the cart address invoice as the one created but there's nothing about the delivery address. Is there some way to set this last by only touching the templates?
  • Create New...

Important Information

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