Jump to content

Search the Community

Showing results for tags 'HelperForm'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Community Help and Support
    • PrestaShop Download
    • PrestaShop Addons
  • News and Announcements
    • PrestaShop news and releases
    • PrestaShop Beta
    • PrestaShop Blogs
    • PrestaShop Meetups
  • International community (English)
    • General topics
    • PrestaShop Merchants
    • PrestaShop Developers
    • Taxes, Translations & Laws
    • Community Modules and Themes
  • Forum francophone
    • Discussion générale
    • Aide et support communautaire
    • PrestaShop pour les marchands
    • PrestaShop pour les développeurs
    • Adaptation aux lois Québécoises
    • Modules et thèmes gratuits
    • Modules et thèmes payants
  • Foro en Español
    • Discusión general
    • Soporte de la comunidad y ayuda
    • Comerciantes PrestaShop
    • Desarrolladores PrestaShop
    • Módulos y plantillas gratuitas
  • Forum italiano
    • Forum generale
    • Aiuto e supporto della Community
    • Commercianti PrestaShop
    • Sviluppatori PrestaShop
    • Aspetti legali sull'eCommerce
    • Moduli e template gratuiti
  • Deutsches Forum
    • Generelle Fragen
    • Support und Hilfe aus der Community
    • e-Commerce/Versand-Handel mit Prestashop
    • Prestashop-Entwickler
    • Anpassung an deutsches Recht
    • Kostenlose Module und Templates
    • Generelle Fragen Copy
  • Nederlandstalig forum
    • Algemeen
    • Hulp en ondersteuning, van en voor de community
    • PrestaShop-winkeliers
    • PrestaShop-ontwikkelaars
    • Het aanpassen van PrestaShop
    • Gratis modules en templates
  • Fórum em Português
    • Fórum Geral
    • Ajuda e Suporte da Comunidade
    • Lojistas que utilizam o PrestaShop
    • Desenvolvedores PrestaShop
    • Legislação específica
    • Módulos e temas gratuitos
  • Polskie forum
    • Forum ogólne
    • Wsparcie i pomoc użytkowników
    • Oferty twórców PrestaShop
    • Deweloperzy PrestaShop
    • Darmowe Moduły i Szablony
  • Dansk forum
    • Generelt forum
    • Hjælp og support fra fællesskabet
    • PrestaShop for købmænd
    • PrestaShop for udviklere
    • Love og regler
    • Gratis moduler og temaer
  • České fórum
    • Instalasi, Konfigurasi dan upgrade
    • Obecná diskuze
    • Bezplatné moduly a šablony
    • PrestaShop vývojáři
    • PrestaShop obchodníci
  • Bahasa Indonesia
    • Diskusi Umum
    • Podpora a pomoc komunity
    • Laporan Bug
    • Jasa, Promosi & Lowongan Kerja
  • Svenskt forum
    • Allmän diskussion
    • Installation, konfigurering och uppdatering
  • Forumul românesc
    • Discuţii generale
    • Instalare, configurare şi upgrade
  • Pусский язык
    • Обсуждение скрипта
    • Установка, Настройка, Обновление
    • Прием багов
  • Slovenské fórum
    • Všeobecná diskusia
    • Podpora a pomoc komunity
    • PrestaShop obchodníci
    • PrestaShop vývojári
    • Bezplatné moduly a šablóny
  • Türkçe Topluluğu
    • Genel Konular
    • Topluluk desteği ve yardım
    • PrestaShop Tüccarları
    • Prestashop Geliştiricileri
    • Ücretsiz Modül ve Temalar
  • Diễn đàn tiếng Việt
    • Thảo luận chung
    • Hỗ trợ từ cộng đồng
    • Dành cho chủ doanh nghiệp / cửa hàng
    • Dành cho lập trình viên
  • PrestaShop Communities
    • اللغه العربيه [Arabic]
    • Ελληνικά [Greek]
    • עִבְרִית [Hebrew]
    • 中文
    • Magyar [Hungarian]
    • 日本語 [Japanese]
    • Lietuviškai [Lithuanian]
    • انجمن فارسی [Persian]
    • ไทย [Thai]
    • Malaysia [Malaysian]
    • Eesti [Estonian]
    • Slovenščina [Slovenian]
    • Српски [Serbian]
  • IP. Board Forum
    • IP. Board Forum Questions and Issues
  • Archive
    • Zapłać Moduły i Szablony [ARCHIVE]
    • Moduly, upravy a dizajn [ARCHIVE]
    • Phát triển và các mô-đun [ARCHIVE]
    • Yazılım, Modül ve Tema [ARCHIVE]
    • Модули, Шаблоны [ARCHIVE]
    • Module şi teme [ARCHIVE]
    • Pengembangan dan Modul [ARCHIVE]
    • Moduler och teman [ARCHIVE]
    • Ecommerce x PrestaShop [ARCHIVE BOARD]
    • Vývoj a moduly [ARCHIVE]
    • Kostenpflichtige Module, Templates [ARCHIVE]
    • Módulos y temas pagos [ARCHIVE]
    • Módulos e temas pagos [ARCHIVE]
    • Servizi commerciali [ARCHIVE]
    • Forum - Feedback Contributor
    • PrestaShop Cloud

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


  1. Hello everyone, How to select an active option in my module? checked options dont work return array( 'form' => array( 'legend' => array( 'title' => $this->l('Choose products'), 'icon' => 'icon-th-large', ), 'input' => array( array( 'type' => 'select', 'label' => $this->l('Products available with a gift'), 'name' => 'selectProductsField', 'class' => 'selectProducts', 'required' => false, 'col' => 5, 'multiple' => true, 'options' => array( 'query' => ProductGiftProduct::getProducts(true), 'id' => 'id_product', 'name' => 'name', 'checked' => 597, ) ), ), 'submit' => array( 'title' => $this->l('Save'), ), ), );
  2. I'm developing a configuration form using the Helper-form , my form has a <select> tag with list of <options> , all this is working my problem is i want to set a specific <option> selected, In another way i want to add an attribute selected to an option in condition of the value , Any Help ?
  3. ¡Buenos días amigos! Soy nuevo en el desarrollo de módulos para Prestashop, así que agradezco cualquier recomendación, consejo o solución que me puedan prestar. El problema que tengo es que al crear un módulo y colocar los campos para el formulario de configuración del módulo coloco uno de los inputs como tipo "tags" y éste no realiza las acciones que debería, creo que tiene que ver con el script de tagify pero indagando en internet encontré que el AdminCmsController.php lo implementa. Por ello entré en el apartado de "Crear paginas" y pude notar que efectivamente aparece y funciona. Por lo que descarté que fuera un problema del js de tagify de la tienda. Por este motivo decidí ver el codigo del AdminCmsController.php : Y copiarlo a mi código, sin embargo el resultado no fue el mismo: Si tienen alguna idea de que hacer para que funciona se los agradecería.
  4. I'm working on a module where it has a back office for the admin to post articles to his prestashop page. I want to give him the option of adding dynamically input fields. For example when the admin clicks on the button add, I want to show something a modal that will have 3 input fields. After the admin will fill the input fields with information he will press the ok button on the modal form. Then the modal will be disappeared but the data that he added on the form will be appears on a table in the helper form in order to be saved when he will click the save button. Can anyone help me to implement this or tell me how to add javascript to the helperform?
  5. I am creating a custom module using PrestaShop 1.7 and I want to be be able to upload an image for the background. The image should be displayed if the field `background_image` is defined. I am able to do it, but the image is outside of the form, as you can see in the image below. The image should be displayed immediately above the background image field, like this (see below). Here is my .tpl file: {if isset($background_image)} <div> <div class="col-lg-3"></div> <div> <img src="/modules/cb_sectionaboutus/img/{$background_image}" class="img-thumbnail" width="400" /> </div> </div> {/if} And here is part of the main PHP file of the module: /** * Load the configuration form */ public function getContent() { /** * If values have been submitted in the form, process. */ if (((bool)Tools::isSubmit('submitCb_sectionaboutusModule')) == true) { $this->postProcess(); } $this->context->smarty->assign('module_dir', $this->_path); /* Passes the background image to the template */ $data = $this->getDataFromDB(); $background_image = $data['background_image']; $this->context->smarty->assign('background_image', $background_image); // About section & Documentation $output = $this->context->smarty->fetch($this->local_path.'views/templates/admin/configure.tpl'); return $output.$this->renderForm(); } /** * Create the form that will be displayed in the configuration of your module. */ protected function renderForm() { $helper = new HelperForm(); $helper->show_toolbar = false; $helper->table = $this->table; $helper->module = $this; $helper->default_form_language = $this->context->language->id; $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG', 0); $helper->identifier = $this->identifier; $helper->submit_action = 'submitCb_sectionaboutusModule'; $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->getConfigFormValues(), /* Add values for your inputs */ 'languages' => $this->context->controller->getLanguages(), 'id_language' => $this->context->language->id ); return $helper->generateForm(array($this->getConfigForm())); } /** * Create the structure of your form. */ protected function getConfigForm() { return array( 'form' => array( 'legend' => array( 'title' => $this->l('Settings'), 'icon' => 'icon-cogs' ), 'input' => array( array( 'type' => 'textarea', 'label' => $this->l('Title'), 'name' => 'title', 'desc' => $this->l('Enter the title'), 'class' => 'rte', 'autoload_rte' => true ), array( 'type' => 'file', 'label' => $this->l('Background Image'), 'name' => 'background_image', 'desc' => $this->l('Maximum image size: ') . $this->upload_file_size_limit_in_mb . ' MB.', 'display_image' => true ) ), 'submit' => array( 'title' => $this->l('Save'), ), ), ); } /** * Set values for the inputs. */ protected function getConfigFormValues() { $data = $this->getDataFromDB(); return array( 'title' => $data['title'], 'background_image' => $data['background_image'] ); } /** * Get the data from the database */ public function getDataFromDB() { $sql = 'SELECT * FROM ' . _DB_PREFIX_ . $this->name . ' WHERE id_' . $this->name . ' = ' . 1; return Db::getInstance()->ExecuteS($sql)[0]; } /** * Save form data. */ protected function postProcess() { /* Current data */ $data_from_db = $this->getDataFromDB(); /* New data */ $form_values = $this->getConfigFormValues(); /* Sets the background image as the old value, in case there is no new upload */ $form_values['background_image'] = $data_from_db['background_image']; /* Validates the background image file */ $file_name = $this->validateFile(); /* Checks whether the background image has been successfully uploaded */ if ($file_name) { /* Sets the new background image */ $form_values['background_image'] = $file_name; } // Has rows in table --> UPDATE if ($data_from_db) { $sql = $sql = "UPDATE " . _DB_PREFIX_ . $this->name . " SET "; foreach (array_keys($form_values) as $key) { $sql .= $key . " = '" . $form_values[$key] . "', "; } $sql = trim($sql, " "); // first trim last space $sql = trim($sql, ","); // then trim trailing and prefixing commas $sql .= " WHERE id_" . $this->name . " = " . 1; } // No rows in table --> INSERT else { $columns = "id_cb_sectionaboutus, " . implode(", ", array_keys($form_values)); $values = array_map('Tools::getValue', array_keys($form_values)); $values = "1, " . "'" . implode("', '", array_values($values)) . "'"; $sql = 'INSERT INTO ' . _DB_PREFIX_ . $this->name . ' (' . $columns . ') VALUES (' . $values . ')'; } Db::getInstance()->ExecuteS($sql); } How can I insert the uploaded image in the middle of the form using HelperForm? I would prefer a solution with HelperForm, but I don't know if it works, so I will accept any answer tha gives me a good solution.
  6. Hello, I would like to program a complete form with helperform on prestashop 1.7. with select, radio button and checkbox. My image attached. It would be an admin side module. And all the information will be stocked in an XML file. I’m in training course and I have 4 weeks to do it. I followed the tutorial at this address: http://doc.prestashop.com/display/PS17/Adding+a+configuration+page So I can just create inputs. Here is my code: <?php if (!defined('_PS_VERSION_')){ exit; } class ModulePresta extends Module { public function __construct() { $this->name = 'modulepresta'; $this->tab = 'front_office_features'; $this->version = '1.0.0'; $this->author = 'Prenom Nom'; $this->need_instance = 0; $this->ps_versions_compliancy = array('min' => '1.7', 'max' => _PS_VERSION_); $this->bootstrap = true; parent::__construct(); $this->displayName = $this->l('Mon module presta'); $this->description = $this->l('Description of my module presta.'); $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); if (!Configuration::get('MYMODULE_PRESTA')) $this->warning = $this->l('No name provided'); } public function install() { if (Shop::isFeatureActive()) { Shop::setContext(Shop::CONTEXT_ALL); } if (!parent::install() || !$this->registerHook('header') || !Configuration::updateValue('MYMODULE_PRESTA', 'Module presta') ) return false; return true; } public function uninstall() { if (!parent::uninstall() || !Configuration::deleteByName('MYMODULE_PRESTA') ) return false; return true; } public function getContent() { $output = null; if (Tools::isSubmit('submit'.$this->name)) { $my_module_name = strval(Tools::getValue('MYMODULE_PRESTA')); if (!$my_module_name || empty($my_module_name) || !Validate::isGenericName($my_module_name)) $output .= $this->displayError($this->l('Invalid Configuration value')); else { Configuration::updateValue('MYMODULE_PRESTA', $my_module_name); $output .= $this->displayConfirmation($this->l('Settings updated')); } Configuration::updateValue('MYMODULE_PRESTA1', Tools::getValue('MYMODULE_PRESTA1')); } return $output.$this->displayForm(); } public function displayForm() { // Get default language $default_lang = (int)Configuration::get('PS_LANG_DEFAULT'); // Init Fields form array $fields_form = array(); $fields_form[0]['form'] = array( 'legend' => array( 'title' => $this->l('Settings'), ), 'input' => array( array( 'type' => 'text', 'label' => $this->l('Configuration value : '), 'name' => 'MYMODULE_PRESTA', 'size' => 20, 'required' => true ), array( 'type' => 'text', 'label' => $this->l('Heure : '), 'name' => 'MYMODULE_PRESTA1', 'size' => 20, 'required' => true ) ), array( 'type' => 'select', 'label' => $this->l('Languages:'), 'name' => 'category', 'required' => true, 'options' => array( 'query' => $options = array( array( 'id_option' => 1, // The value of the 'value' attribute of the <option> tag. 'name' => 'EN', // The value of the text content of the <option> tag. ), array( 'id_option' => 2, 'name' => 'BG', ), ), 'id' => 'id_option', 'name' => 'name', ), ), 'submit' => array( 'title' => $this->l('Save'), 'class' => 'btn btn-default pull-right' ) ); $helper = new HelperForm(); // Module, token and currentIndex $helper->module = $this; $helper->name_controller = $this->name; $helper->token = Tools::getAdminTokenLite('AdminModules'); $helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name; // Language $helper->default_form_language = $default_lang; $helper->allow_employee_form_lang = $default_lang; // Title and toolbar $helper->title = $this->displayName; $helper->show_toolbar = true; // false -> remove toolbar $helper->toolbar_scroll = true; // yes - > Toolbar is always visible on the top of the screen. $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') ) ); // Load current value $helper->fields_value['MYMODULE_PRESTA'] = Configuration::get('MYMODULE_PRESTA'); $helper->fields_value['MYMODULE_PRESTA1'] = Configuration::get('MYMODULE_PRESTA1'); return $helper->generateForm($fields_form); } } Currently I managed to show that 2 inputs On the other hand I saw on other forums that it is necessary to use the following methods: public function renderForm () public function postProcess () while I only use the basic methods: public function getContent () public function displayForm () Your help would be precious to me.
  7. Hi prestashopers. I write a module in which I save information in a complex form - serialized. The display of such information is illegible and unedited, which is why I want to display the input form. I just wanted to insert a value: public function renderForm() { $ unserializedArray = unserialize (AdParameters :: getParametersValue (Tools :: getValue ('id_ad_parameters'))); $ Result = ''; foreach ($ unserializedArray as $ key => $ row) { foreach ($ row as $ element) { $ Result. = '['. $ Element. ']'; } if (isset ($ unserializedArray [$ key + 1])) $ MyValue. = "\ R \ n"; } $ helper-> fields_value ['parameters_value'] = $ MyValue; ................ Form return parent::renderForm(); } AdParameters :: getParametersValue() is function quering DB When I list MyValue everythink is ok but in my list is not ok. However, it does not change the value. I need to replace it in the table and when editing in the form. Can anyone help me with this? Please. if you need a broader explanation, let me know, I'll send them.
  8. Hello all, I'm struggling with the validation of a configuration form for a custom module, I'm trying to keep the code as neat as possible. I use the helperform class to generate the form, I added the required => true, but a novalidate attribute on the <form> make it useless (apart from displaying a pretty red * before the label). Is there a trick I have not discovered to have a working validation with the helper class without overriding anything or doing ajax? I found nothing really interesting on the internet... On a second point, how are you supposed to have a field containing only numbers with the helper class since there's no "number" type field? Thank you very much for your help.
  9. Hello I'm working on a module and trying to create an insert form, so I have extend my class with the AdminController class. I have created a function called renderForm. Now I want to add a custom tpl to this page or using the HelperForm to add dynamic fields. I want to create a simple gallery having 2 fields and one add button. The one filed will be the title of the image and the second input field will be use to add the link of the image. So the user will be able to add as many image he wants on the form before he clicks the save button. Can anyone tell me how i can do it? I dont want the javascript code because I know how i can do it Thank you
  10. I have a back office admin controller in which I am using the helper form in renderform() to generate a form and it is working form but I want a functionality to add more field(If user wants to add a new field like add more services on click then create 2 filed one for sevice name and another one for Service price) in that form dynamically.
  11. Hi community . I'm trying to reimplement my modules backoffice utilizing the new Helper functions of PS 1.5. I've read the documentation but still I have to get used to these functions and their parameters and in particular to the ones pertaining to the select box options. I can't get the right values displayed in the select box options. The $features variable is just an array or array in which the inner one (i.e. the row) is composed by many fields and "id_feature" is one of them. Actually I want to use this last as the value and the "name" field as the text of the option. $fields_form[0]['form'] = array( 'legend' => array( 'title' => $this->l('Settings'), 'image' => $this->_path.'logo.gif' ), 'input' => array( array( 'type' => 'select', 'label' => $this->l('My field:'), 'name' => 'myfield', 'required' => true, 'options' => array( 'query' => $features, 'id' => 'id_feature' ) ) ), 'submit' => array( 'title' => $this->l('Save'), 'class' => 'button' ) ); Thanks in advance to anyone would help me .
  12. Hi, I have a question. In the get function we usually provide the keys (names) to find the values. Is it possible to get what keys (names ) have been defined in the form. I know one way is to go where they have been declared in getConfigForm() function. Apart from that is there any other way. I want to find all the available keys in the form and store them in an array?
  13. 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.
  14. buenas noches comunidad, tengo un problema y que no he podido, ni he encontrado como generar un boton sin funcionalidad con helper form. Lo que quiero es generar el tipico <button type="button"> para despues darle utilidad con JS. De antemano muchas gracias por su ayuda.
  15. 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.
  16. Hi, In a module I want to show a checkbox checked by default. For that I just took the helper class methods like this $display_settings = array( 'form' => array( 'legend' => array( 'title' => $this->l( 'Display Settings' ), 'icon' => 'icon-cogs' ), 'input' => array( array( 'type' => 'checkbox', 'name' => 'display', 'values' => array( 'query' => array( array( 'id' => 'show_header', 'name' => $this->l('show'), 'val' => '1', 'checked' => 'checked' ), ), 'id' => 'id', 'name' => 'name' ) ), ), 'submit' => array( 'title' => $this->l( 'Save Settings' ), 'class' => 'button pull-right', 'name' => 'save-settings', ) ), ); but this one is showing only checkbow (not checked). I tried to chnage val into 0,1. But it did not worked for me. So can someone tell me how to make a checkbox checked in helper class. Any help or suggestions will be really appreceable. Thanks
  17. Salve a tutti, ho iniziato da poco a lavorare con Prestashop ed ho installata la versione 1.5.6, quindi invoco subito il vostro perdono per la mia ignoranza in materia. Sto realizzando un modulo dotato di pagina di configurazione: in questa pagina, oltre al form di configurazione che ho realizzato tramite HelperForm (e che funziona perfettamente), vorrei che comparisse anche una lista che mi permetta di manipolare una tabella MySQL che ho creato ad-hoc. Cercando sulla documentazione, ho trovato la classe HelperList che fa proprio al caso mio, ma non ho ben capito come si usa: devo mettere tutto alla classe del modulo (che estende la classe Module), o devo creare un'altra classe? Al momento la situazione è questa: class MioModulo extends Module{ public function __construct(){ // Codice del costruttore } public function install(){ // Codice metodo install } public function uninstall(){ // Codice metodo uninstall } public function getContent(){ // Codice metodo getContent } public function renderForm(){ // Codice per generare l'HelperForm $fields_list = array( 'id_order' => array( 'title' => $this->l('Order ID'), 'width' => 80, 'align' => 'center', 'type' => 'int', 'orderby' => true ), 'order_status' => array( 'title' => $this->l('Status'), 'width' => 100, 'align' => 'center', 'type' => 'bool', 'icon' => array( 0 => 'disabled.gif', 1 => 'enabled.gif', 'default' => 'disabled.gif' ) ), 'tracking' => array( 'title' => $this->l('Tracking code'), 'width' => auto, 'type' => 'text', 'search' => false ), 'error_message' => array( 'title' => $this->l('Error message'), 'width' => auto, 'type' => 'text', 'search' => false ), ); $helperList = new HelperList(); $helperList->table = self::$mysql_table_name; $helperList->_select = Db::getInstance()->ExecuteS('SELECT * FROM ' ._DB_PREFIX_. self::$mysql_table_name); $helperList->module = $this; $helperList->title = $this->l('Orders'); $helperList->token = Tools::getAdminTokenLite('AdminModules'); $helperList->currentIndex = AdminController::$currentIndex.'&configure='.$this->name; $helperList->show_toolbar = false; $helperList->simple_header = false; // Actions to be displayed in the "Actions" column $helperList->actions = array('delete', 'view'); return $helper->generateForm($fields_form) . "<br/>" . $helperList->generateList($helperList->_select, $fields_list); } } Il risultato che ottengono, è che accedendo alla pagina di configurazione del mio modulo, vedo in alto l'HelperForm (che ricordo funzionare perfettamente) ed in basso l'HelperList popolata con i record della mia tabella. Però molte cose non funzionano: se ad esempio provo a filtrare i risultati per id o status (le prime due colonne), non succede nulla. Ogni singola riga continua ad essere cliccabile, anche se ho provato a specificare il contrario con $helperList->list_no_link = true; E poi, la cosa che più mi preme, non ho capito bene come/dove aggiungere il codice per far funzionare le azioni che ho richiesto con $helperList->actions = array('delete', 'view'); (infatti se clicco sulle icone, che compaiono correttamente, in realtà non mi fa cancellare o esaminare nulla). Scusate ancora se questi per voi sono argomenti di livello base, ma la documentazione di Prestashop non è proprio delle migliori...
  18. hi, am creating a module, and want to use the helperForm and the helperList to manage ans list contents of a slider that i want to integrate within prestashop. so in the ModuleAdminController , after the parent :: __construct(); i have $this->fieldImageSettings = array( 'name' => 'image', 'dir' => 'v' ); $this->fields_list = array ( 'image' => array( 'title' => $this->l('Icon'), 'align' => 'center', 'image' => $this->fieldImageSettings["dir"], 'width' => 70, )), and at the render form : public function renderForm() { // Building the Add/Edit form $this->fields_form = array( 'legend' => array( 'title' => $this->l('Edit') ), 'input' => array( array( 'type' =>'file', 'label'=>$this->l('Link Icon'), 'name'=>'image', 'required' => false, 'display_image' => true ), 'submit' => array( 'title' => $this->l(' Save '), 'class' => 'button' ) ) ); return parent::renderForm(); } but when i upload image , i got The image field is required.
  19. Hi all, i'm a newbie in Prestashop, and i'm using the HelperForm. I want to add a rich text editor to my textarea. I searched on google and found that (in fr). But when i add autoload_rte on my field i have that : http://www.noelshack.com/2016-22-1464766939-capture-du-2016-06-01-09-41-01.png So all my fields are in tinyMCE and i want just my last field... Behind my code : private function createNewAdminForm() { $this->fields_form[] = array( 'form' => array( 'legend' => array('title' => $this->l('ax_banniere')), 'input' => array( array( 'type' => 'text', 'name' => 'title', 'label' => 'Titre', 'required' => true ), array( 'type' => 'text', 'name' => 'date_debut_publication', 'label' => 'Date de début de publication', 'required' => true ), array( 'type' => 'text', 'name' => 'date_fin_publication', 'label' => 'Date de fin de publication', 'required' => true ), array( 'type' => 'textarea', 'name' => 'content', 'label' => 'Contenu', 'rows' => 5, 'cols' => 20, 'lang' => false, 'required' => true, 'autoload_rte' => true, 'hint' => 'Invalid characters: <>;=#{}' ), ), 'submit' => array( 'title' => 'sauvegarder', // This is the button that saves the whole fieldset. 'class' => 'button', 'name' => 'submitax_banniere' ) ) ); $helper = new HelperForm(); $helper->module = $this; $helper->name_controller = $this->name; $helper->token = Tools::getAdminTokenLite('AdminModules'); $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name; $helper->identifier = $this->identifier; $helper->title = 'Ax_banniere_custom'; $helper->show_toolbar = false; $helper->toolbar_btn = $this->_initToolbar(true); $helper->submit_action = 'submitax_banniere'; $c = new Customban(); $helper -> fields_value = array('title' => '', 'date_debut_publication' => '', 'date_fin_publication' => '', 'content'=> ''); return $helper->generateForm($this->fields_form); Note : i'm using Prestashop 1.5, if someone have got any answer it can be great. And sorry for my bad english Thanks
  20. Hello, does anyone know if it's possible to have a datepicker in a helperform, such as being used in the Backoffice > Statistics ? the official documentation ( http://doc.prestashop.com/display/PS15/HelperForm ) doesn't mention it, but perhaps someone here can help me out thanks in advance!
  21. Hola a tod@s, Hoy queremos compartir con la comunidad algo tan sencillo como añadir el editor de textos TinyMCE a tu módulo en Prestashop 1.6 utilizando HelperForm. Esto es algo muy sencillo, pero la documentación que hemos visto por internet está obsoleta o incluso es errónea, así que vamos a aclararlo de una forma muy sencilla y fácil. Este es el objetivo que queremos obtener: Para esto, sólo debemos de añadir estas 2 líneas de código a nuestro input textarea: 'tinymce' => true, Y también: 'autoload_rte' => true, De tal forma que nuestro HelperForm quedaría algo así: $fields_form = array( 'form' => array( 'tinymce' => true, 'legend' => array( 'title' => $this->l('Settings'), 'icon' => 'icon-cogs' ), 'input' => array( array( /* INPUT TYPE TEXT */ 'type' => 'text', 'label' => $this->l('Title'), 'name' => 'input_title', 'id' => 'input_title', 'required' => true, 'desc' => $this->l('Insert your title here').'.', 'hint' => $this->l('Invalid characters:').' <>;=#{}\/', 'is_bool' => false, 'lang' => true, ), array( /* INPUT TYPE TEXTAREA */ 'type' => 'textarea', 'label' => $this->l('Insert your text'), 'name' => 'input_text', 'id' => 'input_text', 'autoload_rte' => true, 'required' => true, 'desc' => $this->l('Insert your SEO text here').'.', 'hint' => $this->l('Invalid characters:').' <>;=#{}\/', 'is_bool' => false, 'lang' => true, ), ), 'submit' => array( 'title' => $this->l('Save'), 'class' => 'btn btn-default pull-right', ), ), ); Con esto ya tendrías tu Editor de texto TinyMCE en tu módulo. Esperamos que les haya sido de utilidad, no duden en comentar. Un saludo.
  22. Bonjour, J'ai entrepris de développer un module nécessitant l'ajout d'une tab dans l'admin d'un produit. Jusque là pas de problème, je me hook sur le hookDisplayAdminProductsExtra. Là où j'ai dû probablement loupé quelque chose, c'est au moment d'ajouter mes nouveaux champs au product_form. Voulant faire les choses proprement, j'ai utilisé le HelperForm, sans me rendre compte tout de suite que toutes les tabs sont englobées dans un seul et même <form> ! Donc je me retrouve avec un <form> dans un <form> : pas bien ! Je n'ai pour le moment pas trouvé de solution à ce problème. Y-a-t-il un moyen pour que le HelperForm::generateForm ne génère que les champs, sans le <form> </form> ? Merci d'avance à toi qui prend le temps de lire ce petit post Bonne journée.
  23. Hola, Estoy desarrollando un módulo para el backoffice en el cuál necesito que en el mismo fieldset del formulario añadir varios botones tipo submit (adjunto captura de lo que quiero). Cuando usas: $helper->submit_action = 'submit'; Capturas el submit con: if (Tools::isSubmit('submit')) { // Lo que quieras hacer } En mi caso tengo (un sólo botón tipo submit): 'submit' => array( 'title' => $this->l('Login'), 'class' => 'btn btn-default pull-left', ), Quisiera poder poner varios botones tipo submit y poder capturar por separado las acciones de cada uno mediante algún if. Nota: la captura pertenece al fichero /controllers/admin/AdminProductsController.php y éste código está hecho en html sin usar HelperForm. El código es el siguiente: $content .= ' <div class="panel-footer"> <a href="'.$this->context->link->getAdminLink('AdminProducts').'" class="btn btn-default"><i class="process-icon-cancel"></i> '.$this->l('Cancel').'</a> <button id="product_form_submit_btn" type="submit" name="submitAddproduct" class="btn btn-default pull-right"><i class="process-icon-save"></i> '.$this->l('Save') .'</button> <button id="product_form_submit_btn" type="submit" name="submitAddproductAndStay" class="btn btn-default pull-right"><i class="process-icon-save"></i> '.$this->l('Save and stay') .'</button> </div> </div>' ; Quiero hacer esto, pero en HelperForm con php y no insertando el código html del ejemplo. ¿Esto es posible? Un saludo, y gracias de antemano.
  24. Bonjour tout le monde Je crée dois actuellement un module coté admin pour avoir une nouvelle page dans l'admin avec des données d'une bdd externe (donc pas la bdd prestashop). 1) J'ai réussi à générer une nouvelle page dans l'admin et à récuperer les données de ma bdd externe grâce aux Helper Prestashop (HelperList ici) seulement après sur le clic des "row actions" par exemple "éditer, supprimer, details) ça ne marche pas, j'ai cru voir que c'était géré avec ObjectModel mais moi j'utilise une bdd externe :/ y'a t'il un moyen quand même ? ou alors un autre moyen pour passer de ma page admin1 à une page admin2 avec transmission de variables en get ou post ? 2) Sinon au pire je n'utiliserai pas les helpers mais dans ce cas comment afficher une page perso dans l'admin avec un tpl perso ? quand j'utilise dans mon controller la méthode initContent avec un display('montpl.tpl') j'ai un bug d'affichage, on dirait que la page s'affiche plusieurs fois (2 headers, 2 sidebar, etc) , enfait le code à l'air d'être injecté avant le doctype... Merci beaucoup à ceux qui seront capable de m'aider ! et bonne journée !
  25. Hola, Quería saber si hay manera de insertar código HTML ejemplo <DIV></DIV> cuando se define los inputs a través de HelperForm. Es para no crear mis propios TPL con el formulario con código intermedio ... Gracias de antemano, Saludos,
×
×
  • Create New...