From cbbe469c2b2e62a0a860e218d2aeb392b8a137be Mon Sep 17 00:00:00 2001 From: Julien Bourdeau Date: Tue, 27 Sep 2016 17:03:40 +0200 Subject: [PATCH] FO: Call template with nice fetch method --- controllers/front/verification.php | 2 +- ps_emailsubscription.php | 10 ++-------- views/templates/front/verification_execution.tpl | 7 ++++++- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/controllers/front/verification.php b/controllers/front/verification.php index ce5c26e..caab8b5 100644 --- a/controllers/front/verification.php +++ b/controllers/front/verification.php @@ -47,6 +47,6 @@ public function initContent() parent::initContent(); $this->context->smarty->assign('message', $this->message); - $this->setTemplate('verification_execution.tpl'); + $this->setTemplate('module:ps_emailsubscription/views/templates/front/verification_execution.tpl'); } } diff --git a/ps_emailsubscription.php b/ps_emailsubscription.php index ac94c07..0d9cba7 100644 --- a/ps_emailsubscription.php +++ b/ps_emailsubscription.php @@ -782,15 +782,9 @@ protected function sendVerificationEmail($email, $token) public function renderWidget($hookName = null, array $configuration = []) { - $cacheId = $this->getCacheId(); - if (Tools::isSubmit('submitNewsletter') || !$this->isCached('ps_emailsubscription.tpl', $cacheId)) { - $this->smarty->assign($this->getWidgetVariables($hookName, $configuration)); - } - if (Tools::isSubmit('submitNewsletter')) { - $cacheId = null; - } + $this->smarty->assign($this->getWidgetVariables($hookName, $configuration)); - return $this->display(__FILE__, 'ps_emailsubscription.tpl', $cacheId); + return $this->fetch('module:ps_emailsubscription/views/templates/hook/ps_emailsubscription.tpl'); } public function getWidgetVariables($hookName = null, array $configuration = []) diff --git a/views/templates/front/verification_execution.tpl b/views/templates/front/verification_execution.tpl index b3b3aff..7f705ed 100644 --- a/views/templates/front/verification_execution.tpl +++ b/views/templates/front/verification_execution.tpl @@ -22,4 +22,9 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} -{$message} \ No newline at end of file +{extends file='page.tpl'} + +{block name="page_content"} + {$message} +{/block} +