absolutic Posted April 24, 2012 Share Posted April 24, 2012 Hi Prestashop Team! I'm working on a module that uses controllers overriding. While installing it copies several overriding files to override/controllers/... and deletes them while uninstalling. But I have a problem when try to override view.tpl from this overriden controller. When I'm working with my own controller which is an instance ModuleAdminController all is ok - I set override_folder for HelperView and place all needed tpl's in my module folder (in the correct folder tree). But I can't set override folder for view.tpl correctly for my overriden controller. if ($this->override_folder) { if ($this->context->controller instanceof ModuleAdminController) $override_tpl_path = $this->context->controller->getTemplatePath().$this->override_folder.$this->base_folder.$tpl_name; else if ($this->module) $override_tpl_path = _PS_MODULE_DIR_.$this->module->name.'/views/templates/admin/_configure/'.$this->override_folder.$this->base_folder.$tpl_name; else $override_tpl_path = $this->context->smarty->getTemplateDir(0).'controllers/'.$this->override_folder.$this->base_folder.$tpl_name; } Because in the final function Helper->CreateTemplate my controller gets into the last else branch of the code above where $this->context->smarty->getTemplateDir(0) returns the path to the current admin theme. I need to call view.tpl which will be placed in my module folder from the controller placed in override/controllers folder. How can I do this without overriding CreateTemplate of Helper class? Thanks. Link to comment Share on other sites More sharing options...
Patrick T. Posted August 31, 2013 Share Posted August 31, 2013 hi absolutic, have you tried to get template directly from the smarty variable with the: $this->context->smarty->createTemplate(path to template folder, $this->context->smarty); in the path to template folder, i can suggest you to start with the directory of the controller, dirname(__FILE__) and get back to template directory 1 Link to comment Share on other sites More sharing options...
Recommended Posts