rasmusb Posted April 26, 2015 Share Posted April 26, 2015 I am creating a module and need to show error, warning and success messages on the configuration page. I have seen code like this in other modules: $this->warnings[] = $this->l('Warning...'); $this->context->smarty->assign('form_infos', $this->warnings); ... but i can't seem to make it work. Is there a way to add messages to an array as text strings and have them rendered using the default error, warning and success prestashop templates? Link to comment Share on other sites More sharing options...
PascalVG Posted April 27, 2015 Share Posted April 27, 2015 Maybe have a look in a file like /modules/blocklink/blocklink.php in function: public function getContent() Where they use calls to functions (defined in classes/module/Module.php) $this->_html .= $this->displayError($this->l('Bad URL')); and $this->_html .= $this->displayConfirmation($this->l('The link has been added.')); Have a look. My 2 cents, pascal. 1 Link to comment Share on other sites More sharing options...
rasmusb Posted April 27, 2015 Author Share Posted April 27, 2015 Thanks Pascal, that's very helpful. I managed to find the last bit I was looking for on my own. By adding... $this->warning = $this->l('Bad configuration.'); ...to the __contruct method a warning is shown whenever the modules admin page is opened. 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