benw Posted May 3, 2017 Share Posted May 3, 2017 With the Starter theme, the Customer "forgot password" page is giving an error: ContextErrorException in smarty_internal_templatebase.php(157) : eval()'d code line 432: Notice: Undefined index: notifications But the error does not happen in the Classic theme, and I can't see the difference - maybe I'm missing something? In "/controllers/front/PasswordController.php", the display() function does NOT pass any notifications to the template: public function display() { $this->context->smarty->assign( array( 'layout' => $this->getLayout(), 'stylesheets' => $this->getStylesheets(), 'javascript' => $this->getJavascript(), 'js_custom_vars' => Media::getJsDef(), 'errors' => $this->getErrors(), 'successes' => $this->getSuccesses(), ) ); $this->smartyOutputContent($this->template); return true; } If I add the notifcations key myself (like in other display functions), then it fixes the error - but I don't want to edit core code, and why doesn't the error happen in the Classic theme? 'notifications' => $this->prepareNotifications() Link to comment Share on other sites More sharing options...
benw Posted May 4, 2017 Author Share Posted May 4, 2017 Solved it. The Classic theme checks whether the variable is set in the template, so I had to copy that to the Starter theme: {theme}/templates/_partials/notifications.tpl {if isset($notifications)} {* template code *} {/if} 4 1 Link to comment Share on other sites More sharing options...
360HD Posted October 30, 2017 Share Posted October 30, 2017 Thank you, you saved my day. I saw several others question about that on prestashop forum, none with answers... (seems since 1.7, prestashop community is almost dead :/) 1 Link to comment Share on other sites More sharing options...
Florian Lemaitre Posted March 27, 2018 Share Posted March 27, 2018 (edited) Here is the solution I adopted for this specific page (all other controllers use notifications). In a custom module I hooked on "displayHeader" with the following code : if (Context::getContext()->controller->php_self === "password") { $this->context->smarty->assign(array( 'notifications' => array( 'error' => Context::getContext()->controller->errors, 'warning' => Context::getContext()->controller->warning, 'success' => Context::getContext()->controller->success, 'info' => Context::getContext()->controller->info, ) )); } A dirty hack but less dirty than the original code from Prestashop (we are used to it...) Edited March 27, 2018 by Florian Lemaitre (see edit history) Link to comment Share on other sites More sharing options...
SteevenQuijije Posted December 19, 2019 Share Posted December 19, 2019 On 3/27/2018 at 3:56 PM, Florian Lemaitre said: Here is the solution I adopted for this specific page (all other controllers use notifications). In a custom module I hooked on "displayHeader" with the following code : if (Context::getContext()->controller->php_self === "password") { $this->context->smarty->assign(array( 'notifications' => array( 'error' => Context::getContext()->controller->errors, 'warning' => Context::getContext()->controller->warning, 'success' => Context::getContext()->controller->success, 'info' => Context::getContext()->controller->info, ) )); } A dirty hack but less dirty than the original code from Prestashop (we are used to it...) Thank you so much i solved with your solution! Link to comment Share on other sites More sharing options...
SteevenQuijije Posted December 19, 2019 Share Posted December 19, 2019 On 5/4/2017 at 12:09 PM, benw said: Solved it. The Classic theme checks whether the variable is set in the template, so I had to copy that to the Starter theme: {theme}/templates/_partials/notifications.tpl {if isset($notifications)} {* template code *} {/if} i tried with this ... but if the notifications is not setting and the template code will not print on my page .... the problem still exist. 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