JTDVNT Posted August 20, 2015 Share Posted August 20, 2015 (edited) Hello there, I am trying to create a custom page to front office. PrestaShop's version is 1.6. My custom controller looks like this: <?php class MyModuleAllProductsModuleFrontController extends ModuleFrontController { public function __construct() { parent::__construct(); $this->context = Context::getContext(); } public function init() { $this->page_name = 'all-products'; parent::init(); } public function initContent() { parent::initContent(); $this->setTemplate(_PS_THEME_DIR_ . 'all-products.tpl'); } } But when I try to access to the page I get the following exception: The template file exists for sure. Why I am getting this error and how I can solve this problem? Thank you to anyone who can help. Edited August 20, 2015 by coldwithin (see edit history) Link to comment Share on other sites More sharing options...
Paul C Posted August 20, 2015 Share Posted August 20, 2015 I don't think you should specify the full path to the template, should you? Prestashop expects your template to be: /modules/<your-module>/views/templates/front/all-products.tpl With the above your code you should just be: $this->setTemplate('all-products.tpl'); That's the standard non-overridden version of your controller's template and I believe there has to be one. Link to comment Share on other sites More sharing options...
nosnevetzy Posted February 7, 2017 Share Posted February 7, 2017 I had the same problem and I solved it by creating the template file to <your-site>/themes/default-bootstrap(or the name of your current theme)/modules/<name of the module> and then from your MyModuleAllProductsModuleFrontController, replace $this->setTemplate(_PS_THEME_DIR_ . 'all-products.tpl'); to $this->setTemplate('all-products.tpl'); 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