Prestashop: Creating a custom page for my module

2019-07-27 01:54发布

问题:

I looking for code which can create a custom page. The code must include all hooks and I should moderate the "home" hook and put my content there...

Anything is helpful - sample code for example, tutorials, documentations or something.

Best regards,

George!

回答1:

Edit: The standard way (for PS1.5 & PS1.6) is to make a controller

Another way (not recommended) is to make a file like this wher you include the header/your content/the footer

<?php 
    global $smarty; 
    include( '../../config/config.inc.php' ); 
    include( '../../header.php' ); 

    $smarty->display( dirname(__FILE__) . '/mymodule_page.tpl' ); 

    include( '../../footer.php' ); 
?> 

what you need to do is save this file in you module folder like newcustompage.php
and then make some link in your .tpl point to it
example:

<a href="{$modules_dir}yourmodulefolder/newcustompage.php">Click this!</a>

Prestashop Developer Guide



回答2:

Try look at: How to create a custom page -> http://www.prestashop.com/forums/topic/52650-how-to-add-a-custom-page/

How to create hooks in your page -> http://www.smaizys.com/prestashop/how-to-create-custom-prestashop-hook/

I hope this helps you. Kind regards