gestrona Posted November 15, 2017 Share Posted November 15, 2017 (edited) Hello, I'm working on a module with similar subscription field like 'Newsletter subscription' from Prestashop devs... (ps_emailsubscription module). Based on it I've changed logic on form submit for email and actually copied whole ps_emailsubcription.tpl into my module. Problem is that with my that copied .tpl it's not working. It lacks styles from .css, logic is corrupted as its not returning on itself after submit... public function renderWidget($hookName = NULL, array $configuration = []) { $this->smarty->assign($this->getWidgetVariables($hookName, $configuration)); return $this->fetch('module:ccmodule/views/templates/hook/ccmodule.tpl'); } public function getWidgetVariables($hookName = NULL, array $configuration = []) { $variables = []; $variables['value'] = Tools::getValue('email', ''); $variables['msg'] = ''; $variables['conditions'] = Configuration::get('NW_CONDITIONS', $this->context->language->id); if (Tools::isSubmit('submitNewsletter')) { $this->registerEmail(); if ($this->error) { $variables['msg'] = $this->error; $variables['nw_error'] = TRUE; } else if ($this->valid) { $variables['msg'] = $this->valid; $variables['nw_error'] = FALSE; } } return $variables; } Theres a code for it... the thing is, that when I write to fetch('module:ps_emailsubscription/views/templates/hook/ps_emailsubscrition.tpl'); everything is working as it should be. Dose anyone knows what I might be missing for that .tpl to get working? Edited November 15, 2017 by gestrona (see edit history) Link to comment Share on other sites More sharing options...
timeens Posted November 28, 2017 Share Posted November 28, 2017 Hi Gestrona! I'm kind of having a similar issue with this module. The template is only rendered properly when I'm fetching a different file: e.g.: Changing: return $this->fetch('module:ccmodule/views/templates/hook/ccmodule.tpl'); to: return $this->fetch('module:ccmodule/views/templates/hook/ccmodule1.tpl'); I hope this helps somehow for your problem. 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