me_von_south Posted February 8, 2017 Share Posted February 8, 2017 Hi guys. New to php and prestashop. Ok so I've worked through the tutorial on creating a new module. Long story short the controller (display.php) calls a template named display.tpl ( I think that was what it's called ) but I get an error that said something like template not found. Then through some debugging I changed the excepetion message to show the path, and it was looking for the template in the classic theme directory. When I copy the template file to that directory it didplays a whole new page with nothing except the template contents. I thought the template needs to be in /views/templates/front folder (if I remember correctly, I'm not in front of my pc at the moment , sending post from my cellphone) of the module. So my question is should the file be in the classic template folder or in the module views... folder ? The tutorial doesn't specify where exactly. There is something else that didn't work exactly like the tut says, but I'll leave that for now. If you guys need someone to update the docs I can do it if you guys want me to:) Let me know Link to comment Share on other sites More sharing options...
me_von_south Posted February 9, 2017 Author Share Posted February 9, 2017 Hi ndiaga. Thanks for your reply. I've tried that however it's still not working. This is my directory tree: ├── config.xml ├── controllers │ └── front │ ├── display.php │ └── display.tpl ├── css │ └── mymodule.css ├── display.php ├── display.tpl ├── error ├── mymodule.php ├── override │ └── display.tpl └── views └── templates ├── front │ └── display.tpl └── hook ├── display.tpl └── mymodule.tpl I've placed display.tpl in many places. I've modified TemplateFinder a bit to show me the directory it's looking for: throw new PrestaShopException('No template found for '.$template . " Directory: [" . $this->directories[0] . "]"); Actual Error when clicking on "Click Here": [PrestaShopException]No template found for display.tpl Directory: [/home/user/Documents/prestashop/project/themes/classic/templates/]at line 71 in file classes/Smarty/TemplateFinder.php 66. return $tpl;67. }68. }69. }70.71. throw new PrestaShopException('No template found for '.$template . " Directory: [" . $this->directories[0] . "]");72. }73.74. private function getTemplateHierarchy($template, $entity, $id)75. {76. $entity = basename($entity); TemplateFinderCore->getTemplate - [line 1338 - classes/controller/FrontController.php] - [4 Arguments] FrontControllerCore->getTemplateFile - [line 1236 - classes/controller/FrontController.php] - [3 Arguments] FrontControllerCore->setTemplate - [line 61 - classes/controller/ModuleFrontController.php] - [3 Arguments] ModuleFrontControllerCore->setTemplate - [line 7 - modules/mymodule/controllers/front/display.php] - [1 Arguments] mymoduledisplayModuleFrontController->initContent - [line 201 - classes/controller/Controller.php] ControllerCore->run - [line 366 - classes/Dispatcher.php] DispatcherCore->dispatch - [line 28 - index.php] Any idea what the problem could be? Link to comment Share on other sites More sharing options...
me_von_south Posted February 9, 2017 Author Share Posted February 9, 2017 I've started again and repeated the tutorial steps and I still get the same error. Could it be because of changes made in 1.7 that's not updated in the docs? I'm working on release 1.7 Link to comment Share on other sites More sharing options...
me_von_south Posted February 9, 2017 Author Share Posted February 9, 2017 (edited) I've installed Prestashop 1.6 and copied the module folder to version 1.6 and it works in version 1.6. Now when I click on "Click me" it shows the contents of the template: "Welcome to my shop!". So I think it could be that the docs is not updated. How do I fix it though ? What has changed in version 1.7? Edited February 9, 2017 by me_von_south (see edit history) Link to comment Share on other sites More sharing options...
me_von_south Posted February 9, 2017 Author Share Posted February 9, 2017 Ok so where can I find an example of a basic module for 1.7? 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