Hi all !
It is really easy to set up a new custom page in Prestashop.
I’ll briefly reproduce this method for clarity:
Create initial page in your prestashop root folder (e.g. your-page-name.php). Fill it with this code:
<?php
require(dirname(__FILE__).'/config/config.inc.php');
Tools::redirect('index.php?controller=your-page-name'.($_REQUEST ? '&'.http_build_query($_REQUEST, '', '&') : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently');
Create controller in controllers/front/YourPageNameController.php. Fill in this code:
<?php
class YourPageNameControllerCore extends FrontController
{
public $php_self = ' your-page-name ';
public function setMedia()
{
parent::setMedia();
$this->context->controller->addCSS(_THEME_CSS_DIR_.' your-page-name.css', 'all');
}
public function displayContent()
{
parent::displayContent();
self::$smarty->display(_PS_THEME_DIR_.' your-page-name.tpl');
}
} Create view in themes/yourTheme/ your-page-name.tpl.
And voilà we have a new custom page which can be accessed like your-domain.fr/your-page-name
But the question is how to create a “second-level” link for another subsidiary custom page like: your-domain.fr/your-page-name/another-custom-page ?
P.S. I don’t really want to use Apache mod_rewrite for this purpose. Maybe this can be done with plain PHP methods? Like in Zend Framework where you can create actions for controller classes to achieve this link structure: your-domain.fr/controller-name/action-name/parameter1/value1/.../parameterN/valueN