Adding new pages

front_prestashop16

Creating new pages is a feature that allows us to add many variations to our shop. In this post we will see how we can create a new page with all of its features.

To do this we will follow these steps

 

– Create new controller file “MynewpageController.php” and placed inside /controllers/front/ :

 

<?php  
class MynewPageControllerCore extends FrontController
 {
 public $php_self = 'my-newpage';
 public $auth = true;
 public $ssl = true;
 public function initContent() { parent::initContent(); $this--->setTemplate(_PS_THEME_DIR_.'my_newpage.tpl');
 }
}


– Create template file “my_newpage.tpl” and placed inside /themes/YOUR_THEME/
contents :

 

{capture name=path}{l s='My Page'}{/capture}

<h1 class="page-heading">{l s='My Page'}</h1>
<div class="container">
{l s='Hello World ...'}
</div>

– Delete file /cache/class_index.php

– Go to Back Office > Preferences > SEO & URL >> Add New Page
Page : mynewpage (required)
Page title : My new Page (optional)
Rewritten URL : my-newpage (required)

– Finally you can check the result on your shop with this URL http://YOUR_DOMAIN/index.php?controller=my-newpage

 

 

Posted on 16/07/2014 in Prestashop

Share the Story

About the Author

Leave a reply

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Back to Top