akuandi Posted June 19, 2016 Share Posted June 19, 2016 (edited) Hi all, I'm new to all this stuff, I'm not a programmer, so sorry if I'm getting sth wrong, and thanks a lot for your help! I am trying to write my first custom module for my shop. It is suposed to be a kind of tutorial or book. Several pages with different information. It shouldn't be very complicated, but I found the CMS system included in Prestashop quite limiting (maybe i'm wrong, but I prefered to develop my own module just in order to learn about all this) I followed some tutorial and got to work my first basic module with no problem. I have it listed in the left column. I can create as many .tpl files for the different pages, but I don't know how to use the linking system in order to link each page to one link listed in the left column. If possible, I would also like to use the language translation system, but I don't know if that is too much by now. As far as I can guess, I assume I have to edit my display.php file, initContent method, in order to set different templates for each of the pages? " class mymoduledisplayModuleFrontController extends ModuleFrontController{ public function initContent() { parent::initContent(); $this->setTemplate('display.tpl'); //$this->setTemplate('display2.tpl'); }} " Can sby give me some orientation? Thanks again! Edited June 19, 2016 by akuandi (see edit history) Link to comment Share on other sites More sharing options...
roja45 Posted June 19, 2016 Share Posted June 19, 2016 I think it should be straight-forward enough. In your module you hook in to the display left column to show your links, right? Each of those links would then be generated by the getModuleLink: $controller_url = $this->context->link->getModuleLink('mymodule', 'displayModule', array(), true); Add on a parameter or two to indicate to the controller which page you want, and it will load the correct template. Not sure you'd be able to detect which sub-page you had loaded in the left column hook, if you were trying to show which page they were on there, without storing something in a cookie, or using some javascript, or maybe working it out from the url. Translation comes along for free, if you're using the templates. Is that what you mean, or did I misunderstand something? Link to comment Share on other sites More sharing options...
akuandi Posted June 19, 2016 Author Share Posted June 19, 2016 (edited) Hi Roja45, Thank you very much! That's exactly what I needed to know. I assumed it should be easy, but didn't expect it to be solved so fast. It's already running :-) A small step for sw science, but a great jump in my mastering of Prestahop!!! hahehihohu!!! Edited June 19, 2016 by akuandi (see edit history) 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