Jump to content

Search the Community

Showing results for tags 'renderForm'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Community Help and Support
    • PrestaShop Download
    • PrestaShop Marketplace
  • 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


Found 6 results

  1. Hi, I have done a form to add information for my module, but know, i don't know how i can't differentiate between add form and edit form. Someone can help me? And how i can get data to fill the form in the edit mode? Thanks everyone for the help!
  2. Hi all, I created a class for my module which uses helper form to edit a record in my table. AdminBlockQuoteController My SQL query successfully loads the data to the list. But when I select to edit a record, it loads the form, but with no data. When I debug using smarty console, my fields_list values are empty. I've created this looking at the 1.6 document http://doc.prestashop...... Could anyone help? Thanks!! Simon <?php class AdminBlockQuoteController extends ModuleAdminController { public function __construct() { $this->context = Context::getContext(); $this->bootstrap = true; $this->table = 'custom_order'; $this->identifier = 'id_custom_order'; $this->className = 'BlockQuote'; $this->lang = false; $this->_select = 'CONCAT(LEFT(cu.`firstname`, 1), \'. \', cu.`lastname`) AS `customer` '; $this->_join = 'LEFT JOIN `'._DB_PREFIX_.'customer` cu ON (cu.`id_customer` = `user_id`)'; $this->fields_list = array( 'id_custom_order' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'request_details' => array('title' => $this->l('Request Details'), 'width' => 230), 'date_needed' => array('title' => $this->l('Date Needed By'), 'align' => 'center', 'width' => 30), 'request_price' => array('title' => $this->l('Request Price'), 'align' => 'center', 'width' => 20), 'customer' => array('title' => $this->l('Customer'), 'align' => 'center', 'width' => 40), 'quote_price' => array('title' =>$this->l('Quote Price'), 'align'=>'center', 'width' => 20), 'date_agreed' => array('title' =>$this->l('Date Agreed'), 'align'=>'center', 'width' => 30), ); $this->bulk_actions = array( 'delete' => array( 'text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'), 'icon' => 'icon-trash' ) ); parent::__construct(); } // This method generates the list of results public function renderList() { // Adds an Edit button for each result $this->addRowAction('edit'); // Adds a Delete button for each result $this->addRowAction('delete'); return parent::renderList(); } public function renderForm() { $this->fields_form = array( 'legend' => array( 'title' => $this->l('Edit Quote'), 'icon' => 'icon-envelope-alt' ), 'input' => array( array( 'type' => 'textarea', 'label' => $this->l('Request Details'), 'name' => 'request_details', 'required' => true, 'lang' => false, 'col' => 6, 'hint' => $this->l('Details of the custom request'), ), array( 'type' => 'date', 'label' => $this->l('Date Requested'), 'name' => 'date_needed', 'required' => false, 'col' => 4, 'hint' => $this->l('Date requested by customer'), ), array( 'type' => 'text', 'label' => $this->l('Price Requested'), 'name' => 'request_price', 'required' => false, 'lang' => false, 'col' => 4, 'hint' => $this->l('Price requested by customer'), ), array( 'type' => 'text', 'label' => $this->l('Quote Price'), 'name' => 'quote_price', 'required' => false, 'lang' => false, 'col' => 4, 'hint' => $this->l('Price quoted by store'), ), array( 'type' => 'date', 'label' => $this->l('Date Agreed'), 'name' => 'date_agreed', 'required' => false, 'lang' => false, 'col' => 4, 'hint' => $this->l('Date quoted by store'), ), ), 'submit' => array( 'title' => $this->l('Save'), 'class' => 'button' ) ); return parent::renderForm(); } }
  3. Hi all, I'm facing a problem with the HelperForm and an input of password type: I'm developing a module for PrestaShop 1.6 with Bootstrap support and in my renderForm() method I declare my form fields like this: $fields_form[0]['form'] = array( 'legend' => array( 'title' => $this->l('Settings'), 'icon' => 'icon-cogs' ), 'input' => array( // All my fields here ), 'submit' => array( 'title' => $this->l('Save'), 'class' => 'button pull-right' ) ); One of these fields is an input of type password and I've declared it like this: array( 'type' => 'password', 'label' => $this->l('Password'), 'desc' => $this->l('My pwd description'), 'name' => 'MY_PASSWORD', 'required' => true ) And at the end of same method, just before the return statement, I load the current value like this: $helper->fields_value['MY_PASSWORD'] = Configuration::get('MY_PASSWORD'); The problem is that when I enter in the configuration page of my module, the password field is rendered with the Bootstrap nice CSS, but it is always empty. If I write inside it and then I save settings it works (I mean I get no error) but when page reload that field is empty again. If I change is type as a common text field like this: array( 'type' => 'text', 'label' => $this->l('Password'), 'desc' => $this->l('My pwd description'), 'name' => 'MY_PASSWORD', 'required' => true ) the problem vanish and it work as intended. Thanks you all for your time and attention.
  4. Hi, I am doing a small module in prestashop. In that module I want to show all the product category in the checkbox type. Lets say in the default prestashop installation(1.6) we have 3 main categories ( 1. Casual Dresses 2. Evening Dresses 3. Summer Dresses ) Now I want them in a tree manner with the checkboxes in a module backend( inside function renderForm() ). So can someone kindly tell me how to do this? How to make the query in side the renderFor(helper class) and show them as a checkbox? Any help and suggestions will be really appreciable. Thanks.
  5. Hi, Prestashop 1.5.x recommends using AdminController::renderForm() for rendering. There is a path of the classes cooperation: AdminController::renderForm() -> HelperForm::generateForm() -> HelperForm::generate() -> Hepler::generate() and Helper::createTemplate() public function renderForm() { if (!$this->default_form_language) $this->getLanguages(); if (Tools::getValue('submitFormAjax')) $this->content .= $this->context->smarty->fetch('form_submit_ajax.tpl'); if ($this->fields_form && is_array($this->fields_form)) { if (!$this->multiple_fieldsets) $this->fields_form = array(array('form' => $this->fields_form)); // For add a fields via an override of $fields_form, use $fields_form_override if (is_array($this->fields_form_override) && !empty($this->fields_form_override)) $this->fields_form[0]['form']['input'][] = $this->fields_form_override; $helper = new HelperForm($this); $this->setHelperDisplay($helper); $helper->fields_value = $this->getFieldsValue($this->object); $helper->tpl_vars = $this->tpl_form_vars; !is_null($this->base_tpl_form) ? $helper->base_tpl = $this->base_tpl_form : ''; if ($this->tabAccess['view']) { if (Tools::getValue('back')) $helper->tpl_vars['back'] = Tools::safeOutput(Tools::getValue('back')); else $helper->tpl_vars['back'] = Tools::safeOutput(Tools::getValue(self::$currentIndex.'&token='.$this->token)); } $form = $helper->generateForm($this->fields_form); return $form; } } /** * Create a template from the override file, else from the base file. * * @param string $tpl_name filename * @return Template */ public function createTemplate($tpl_name) { if ($this->override_folder) { if ($this->context->controller instanceof ModuleAdminController) $override_tpl_path = $this->context->controller->getTemplatePath().$this->override_folder.$this->base_folder.$tpl_name; else if ($this->module) { $override_tpl_path = _PS_MODULE_DIR_.$this->module->name.'/views/templates/admin/_configure/'.$this->override_folder.$this->base_folder.$tpl_name; } else { if (file_exists($this->context->smarty->getTemplateDir(1).DIRECTORY_SEPARATOR.$this->override_folder.$this->base_folder.$tpl_name)) $override_tpl_path = $this->context->smarty->getTemplateDir(1).DIRECTORY_SEPARATOR.$this->override_folder.$this->base_folder.$tpl_name; else if (file_exists($this->context->smarty->getTemplateDir(0).DIRECTORY_SEPARATOR.'controllers'.DIRECTORY_SEPARATOR.$this->override_folder.$this->base_folder.$tpl_name)) $override_tpl_path = $this->context->smarty->getTemplateDir(0).'controllers'.DIRECTORY_SEPARATOR.$this->override_folder.$this->base_folder.$tpl_name; } } else if ($this->module) { $override_tpl_path = _PS_MODULE_DIR_.$this->module->name.'/views/templates/admin/_configure/'.$this->base_folder.$tpl_name; } if (isset($override_tpl_path) && file_exists($override_tpl_path)) return $this->context->smarty->createTemplate($override_tpl_path, $this->context->smarty); else return $this->context->smarty->createTemplate($this->base_folder.$tpl_name, $this->context->smarty); } But how i can set the $helper->mobile value? Is there the right way without any method overrides? And what is the strange file path uses ($override_tpl_path = _PS_MODULE_DIR_.$this->module->name.'/views/templates/admin/_configure/'.$this->override_folder.$this->base_folder.$tpl_name;)? Regards
  6. Bonjour je crée actuellement un module perso administrable en back. j'ai créé le controller étendu de ModuleAdminController. j'utilise la méthode renderForm() pour gérer le formulaire d'ajout/modification des éléments : public function renderForm(){ $this->fields_form = array( 'legend' => array( 'title' => $this->l('Element') ), 'submit' => array( 'title' => $this->l('Save'), 'class' => 'button' ), 'input' => array( array( 'type' => 'text', 'label' => $this->l('Nom'), 'name' => 'name', 'size' => 33, 'required' => true, 'desc' => $this->l("Nom de l'élément") ), array( 'type' => 'radio', 'label' => $this->l('Type'), 'name' => 'type', 'size' => 33, 'class' => 't', 'required' => true, 'desc' => $this->l('Choix de la vente'), 'values' => array( array('id'=>'elt_amount','label'=>$this->l('Quantité'),'value'=>'amount'), array('id'=>'elt_weight','label'=>$this->l('Poids'),'value'=>'weight') ) ), array( 'type' => 'text', 'label' => $this->l('ID Produit'), 'name' => 'ocp_id_product', 'required' => true, 'desc' => $this->l('Begin typing the first letters of the product name, then select the product from the drop-down list'), ), array( 'type' => 'select', 'label' => $this->l('ID Catégorie Elt'), 'name' => 'id_element_categ', 'options'=> array( 'query'=>CategoryCustomProduct::getCategoriesOCP(), 'id'=>'id_onet_customproduct_categorie', 'name'=>'name' ) ), array( 'type' => 'radio', 'label' => $this->l('Actif?'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array( array( 'id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled') ), array( 'id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled') ) ), 'desc' => $this->l('Enable Element in the Front Office') ), ) ); return parent::renderForm(); } je liste donc ci-dessus les champs présents dans ma table; le champ "ocp_id_product" est utilisé pour afficher via un Jquery autocomplete la liste des produits du catalogue. j'ai ajouté dans le script ci-dessous un champs caché pour récupérer l'ID du produit pour le renvoyer dans ma table ensuite. $(window).load(function () { /* function autocomplete */ $('#ocp_id_product').autocomplete('ajax_products_list.php', { minChars: 1, autoFill: true, max:20, matchContains: true, mustMatch:true, scroll:false }).result(function(event,data,formated){ $("#ocp_id_product_result").remove(); $("#ocp_id_product").after('<div id="ocp_id_product_result"><input type="hidden" id="ocp_id_product_val" name="ocp_id_product_val" value="'+data[1]+'" /><strong>'+data[0]+'</strong><span class="delOcpIdProduct" name="'+data[1]+'" style="cursor: pointer;"><img src="../img/admin/delete.gif"></span></div>'); }); }); Et c'est là ou cela se complique ! j'ai essayé d'overrider la méthode beforeAdd pour intervertir les valeurs ocp_id_product_val => ocp_id_product, mais sans sans succès... et si je passe par la méthode processUpdate, le copyFromPost ne prends pas en compte mon champs caché supplémentaire... Si quelqu'un a une idée comment faire ?
×
×
  • Create New...