Create custom page in Prestashop

 

ust create a controller with the name you want for the page, and put it in /classes/front/. The name of the controller must be NameyouwantforthepageController.php

Here is a basic class that will work:

class MyPageController extends FrontController {
	/**
	 * * Initialize
	 * controller * @see FrontController::init()
	 */
	public function init() {
		parent::init ();
	}
	/**
	 * * Assign template vars related to page content *
	 * 
	 * @see FrontController::initContent()
	 */
	public function initContent() {
		parent::initContent ();
		$this->setTemplate ( _PS_THEME_DIR_ . my - page . tpl );
	}
}

Take a look at the FrontController to see what method you need to override to add functionnalities, for example setMedia() to add CSS / JS files.

You will then be able to add a pretty url in the back office in the SEO panel.

Author: bm on January 10, 2014
Category: prestashop