amos-n-andy Posted May 20, 2014 Share Posted May 20, 2014 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 Link to comment Share on other sites More sharing options...
loulou66 Posted May 20, 2014 Share Posted May 20, 2014 HI in you tpl of 1st page in the link for 2nd page <a href="{$link->getPageLink('your2nd_page_on_root_of_ps.php')}">{l s='your2nd_page_on_root_of_ps'}</a> and like the the1st page "your2nd_page_on_root_of_ps.php" call the controller and controler call tpl in the theme @++ Loulou66 Link to comment Share on other sites More sharing options...
amos-n-andy Posted May 20, 2014 Author Share Posted May 20, 2014 Hi loulou66. Thanks for the reply. Maybe I wasn't clear enough but the goal I want to achieve is the link to the 2nd page like domain.fr/blog/entry Where blog is the 1st custom page and entry is the 2nd Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now