Create custom page in Prestashop 1.5.3

后端 未结 4 604
无人共我
无人共我 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:47

    1. Create a custom page controller in the override directory - override/controllers/front/CustompageController.php

    class CustompageController extends FrontController{ 
    
        //add js / css required for the custom page
    
        public function setMedia(){
            $this->context->controller->addJS(_THEME_JS_DIR_.'custom-page.js');
            $this->context->controller->addCSS(_THEME_CSS_DIR_.'custom-page.css');
            parent::setMedia();
        }
    
        public function initContent(){
    
            //preparingdata for passing to the custom page
            $name = 'Gofenice Technologies';
            $expert_in = array('Prestashop Development', 'Prestashop Customization', 'Prestashop Custom Module Development', 'Prestashop Page Speed Optimization');
            $this->context->smarty->assign(array(
                    'company_name' => $name,
                    'expert_in' => $expert_in
                ));
            //data ends-here
    
            //pass data to template file
            $this->setTemplate(_PS_THEME_DIR_.'custom-page.tpl');
    
    
            //show left/ right columns - will be true and shown by default
            $this->display_column_left = false;
            $this->display_column_right = false;
    
            //call parent initcontent - this is for loading the site's default header, footer, left and right columns
            parent::initContent();
        }
    }
    
    1. A template for our new custom page - themes/site-current-theme/custom-page.tpl

      {$company_name}

      {l s='Expert In'}

        {foreach from=$expert_in item=skill}
      • {$skill}
      • {/foreach}

    creating custom front page in prestashop

提交回复
热议问题