JoelWebsites Posted January 30, 2015 Share Posted January 30, 2015 Below is the code I have tried to create in my test module I am getting Fatal errors Fatal error: Call to undefined method testmoduledisplayModuleFrontController::addRowAction() in testmoduledisplayModuleFrontController::l() in and similar errors .. How do I solve them ? thank you.. <?php class testmoduledisplayModuleFrontController extends ModuleFrontController { public function initContent() { parent::initContent(); $this->setTemplate('display.tpl'); $this->renderForm(); } public function __construct() { $this->context = Context::getContext(); $this->table = 'games'; $this->className = 'Games'; $this->lang = true; $this->addRowAction('edit'); $this->addRowAction('delete'); $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'))); $this->multishop_context = Shop::CONTEXT_ALL; $this->fieldImageSettings = array( 'name' => 'image', 'dir' => 'games' ); $this->fields_list = array( 'id_game' => array( 'title' => $this->l('ID'), 'width' => 25 ) ); $this->identifier = 'id_game'; parent::__construct(); } public function renderForm() { if (!($obj = $this->loadObject(true))) return; $games_list = Activity::getGamesList(); $this->fields_form = array( 'tinymce' => true, 'legend' => array( 'title' => $this->l('Game'), 'image' => '../img/admin/tab-payment.gif' ), 'input' => array( array( 'type' => 'select', 'label' => $this->l('Game:'), 'desc' => $this->l('Choose a Game'), 'name' => 'id_games', 'required' => true, 'options' => array( 'query' => $games_list, 'id' => 'id_game', 'name' => 'name' ) ), array( 'type' => 'text', 'label' => $this->l('Game Title:'), 'name' => 'name', 'size' => 64, 'required' => true, 'lang' => true, 'hint' => $this->l('Invalid characters:').' <>;=#{}' ), array( 'type' => 'file', 'label' => $this->l('Photo:'), 'name' => 'uploadedfile', 'id' => 'uploadedfile', 'display_image' => false, 'required' => false, 'desc' => $this->l('Upload your document') ) ) ); $this->fields_form['submit'] = array( 'title' => $this->l(' Save '), 'class' => 'button' ); return parent::renderForm(); } } Link to comment Share on other sites More sharing options...
JoelWebsites Posted January 30, 2015 Author Share Posted January 30, 2015 (edited) Can anybody help me solve these errors?...I just want to show a form ..using helper form in my front office Call to undefined method testmoduledisplayModuleFrontController::l() Edited January 30, 2015 by JoelWebsites (see edit history) Link to comment Share on other sites More sharing options...
JoelWebsites Posted January 30, 2015 Author Share Posted January 30, 2015 Does anybody have any ideas? Link to comment Share on other sites More sharing options...
rickczsu Posted December 27, 2015 Share Posted December 27, 2015 Old topic, but for others, you need to use $this->module->l instead of $this->l Link to comment Share on other sites More sharing options...
Sandeep Tiwari Posted December 15, 2016 Share Posted December 15, 2016 @rickczsu not working Link to comment Share on other sites More sharing options...
Steeve Posted December 23, 2017 Share Posted December 23, 2017 (edited) JoelWebSites You can't create a form with the Helper in the Front Controller like in the Admin Controller. You have to do it the old way, with the template and everything. If you check the ModuleFrontController class and the FrontController class, you can see that their construct is very different from yours. The Helper is only for BackOffice And in the FrontController, you can do a function like this : protected function l($string) { return Translate::getModuleTranslation('name_module', $string, 'name_front_controller'); } And then $this->l() All the errors you get is because all the functions and properties you are calling don't exist in the FrontController, only in the AdminController. But maybe in future versions of Prestashop it will be possible with the integration of Symfony Edited December 23, 2017 by Steeve (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