Create custom page in Prestashop 1.5.3

后端 未结 4 603
无人共我
无人共我 2020-12-05 15:47

I\'d like to create a custom page in Prestashop 1.5.3 without using CMS.

Unfortunately I can not find any tutorials that are working with 1.5.3.

So far I hav

4条回答
  •  时光说笑
    2020-12-05 16:45

    Hello geys this solution work perfectlly with override also.

    1/ in the folder /override create page manufacturer-detail.php and put this code:

    include(dirname(FILE).'/config/config.inc.php'); Controller::getController('ManufacturerDetailController')->run();

    Tools::displayFileAsDeprecated();

    include(dirname(FILE).'/header.php');

    $smarty->display(_PS_THEME_DIR_.'manufacturer-detail.tpl');

    include(dirname(FILE).'/footer.php');

    2/ In the folder /override/controllers/front create page manufacturerDetailController.php and put this code:

    class ManufacturerDetailController extends FrontController{

    /*public $php_self = 'manufacturer-detail';  */  /* optional */
    
    public function init(){ 
        parent::init(); 
    } 
    
    public function initContent(){ 
        parent::initContent(); 
        $this->setTemplate(_PS_THEME_DIR_.'manufacturer-detail.tpl'); 
    } 
    
     /*  The following code portion is optional.
    

    * Remove the double-slashes to activate the portion * if you want to use external stylesheet and JavaScript for the page. * Create the CSS and JS files in the css and js directories of the theme accordingly */

    //public function setMedia(){
      //parent::setMedia();
      //$this->addCSS(_THEME_CSS_DIR_.'custom-page.css');
      //$this->addJS(_THEME_JS_DIR_.'custom-page.js');
    //}
    

    }

    3/ in the folder /themes/your-default-theme create page manufacturer-detail.php and put this code:

    Hello world

    4/ You can go to SEO & URLs in your back office and add new url

    You can access tou your page http://yourstore.com/index?controller=ManufacturerDetail

    OR

    http://yourstore.com/urr-you-have-added-from-back-office

提交回复
热议问题