filene Posted February 6, 2015 Share Posted February 6, 2015 Hello, I don't manage to display a form within the HelperForm generator in a module i'm currently coding This module adds a new tab when editing a Product in the backoffice. This tab is supposed to help generating combinations for my products in an easier way: those products are restaurants with date and hour attributes to allow reservations. I therefore hooked the module to displayAdminProductsExtra (and actionProductUpdate). I want the form to be displayed in this Admin Product Tab. I obviously first tried to code my form in a .tpl file to display, but it causes errors. ( My datepickers don't hide because of a jquery error on jquery-validate.js when validating each input.). That's why I decided to generate my form all clean with a HelperForm. This is what my code looks like: class Reservation extends Module { //blabla, construct, install, uninstall, getContent, displayForm public function displayFormAdminProductsExtra() { $fields_form[0]['form'] = array(//blabla); $helper = new HelperForm(); $helper->module = $this; $helper->name_controller = $this->name; $helper->token = Tools::getAdminTokenLite('AdminModules'); $helper->currentIndex = AdminController::$currentIndex. '&configure='.$this->name; //blabla helper config return $helper->generateForm($fields_form); } public function hookDisplayAdminProductsExtra () { //blabla return $this->displayFormAdminProductsExtra(); } } The extra tab in AdminProduct is then empty. What am i doing wrong ? Thank you so much for your reply ! Link to comment Share on other sites More sharing options...
Peter PANC Posted November 7, 2018 Share Posted November 7, 2018 (edited) Mine is like this; public function hookDisplayAdminProductsExtra($params) { $this->context->smarty->assign(array( 'product_id' => $params['id_product'], 'product_name' => 'test' )); return $this->context->smarty->fetch($this->local_path.'views/templates/admin/DisplayAdminProductsExtra.tpl'); } It displays the TPL file i selected. I think you want something diferent like render a form Edited November 7, 2018 by Peter PANC (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