zalafa Posted July 8, 2014 Share Posted July 8, 2014 (edited) Hi there, I've been playing with prestasop 1.6 for about 6 months, my domain is http://zalafa.com, i want to add a single custom php page to prestashop? But i dunno how to achieve it. If i edit those things in prestashop backend CMS module i am afraid i can't do it with {php}{/php} prestashop tpl tags. I have tried inputting some php syntax like '{php}echo "sdf";{/php}' inside page content, but the system prints them literally instead of being interpreted. http://zalafa.com/en/content/6-cek-resi-disini will go to single php file containing php syntax for pulling records from database about simple listing of customers shipping consignee number. Thanks for your help Edited July 8, 2014 by zalafa (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted July 8, 2014 Share Posted July 8, 2014 {php}{/php} tags aren't allowed to use in prestashop, so it's not possible to create page in that way anyway, just wondering, how you wanted to create separated page with these tags? i have no idea you need to create front office controller check this: http://stackoverflow.com/questions/14336006/create-custom-page-in-prestashop-1-5-3 it's based on 1.5.x but the idea is the same for ps 1.6 Link to comment Share on other sites More sharing options...
zalafa Posted July 8, 2014 Author Share Posted July 8, 2014 {php}{/php} tags aren't allowed to use in prestashop, so it's not possible to create page in that way anyway, just wondering, how you wanted to create separated page with these tags? i have no idea you need to create front office controller check this: http://stackoverflow.com/questions/14336006/create-custom-page-in-prestashop-1-5-3 it's based on 1.5.x but the idea is the same for ps 1.6 Hi Vekia, Yes i have followed those instructions on that link i have created a link for that http://zalafa.com/index.php?controller=CekResi And i have put the cek-resi.tpl file in a folder of public_html/themes/default-bootstrap, and i have also type some strings in that file but the link doesn't show any feedbacks Link to comment Share on other sites More sharing options...
zalafa Posted July 8, 2014 Author Share Posted July 8, 2014 (edited) {php}{/php} tags aren't allowed to use in prestashop, so it's not possible to create page in that way anyway, just wondering, how you wanted to create separated page with these tags? i have no idea you need to create front office controller check this: http://stackoverflow.com/questions/14336006/create-custom-page-in-prestashop-1-5-3 it's based on 1.5.x but the idea is the same for ps 1.6 Vekia, this is the file content for the controller resides in directory /overrides/controllers/front/ class CekResi 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_.'cek-resi.tpl'); } } Edited July 8, 2014 by zalafa (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted July 8, 2014 Share Posted July 8, 2014 try to place this file in original controllers directory too /controllers/front/ after that remove cache/class_index.php file refresh page, class index file will be regenerated automatically. Link to comment Share on other sites More sharing options...
zalafa Posted July 8, 2014 Author Share Posted July 8, 2014 (edited) try to place this file in original controllers directory too /controllers/front/ after that remove cache/class_index.php file refresh page, class index file will be regenerated automatically. uhm yea i follow but no changes at all , still blank page http://zalafa.com/index.php?controller=CekResi Edited July 8, 2014 by zalafa (see edit history) Link to comment Share on other sites More sharing options...
zalafa Posted July 9, 2014 Author Share Posted July 9, 2014 ops i got this line in error_logs [09-Jul-2014 09:17:43 Asia/Jakarta] PHP Fatal error: Class 'CekResi' not found in /home/zalafaco/public_html/classes/controller/Controller.php on line 135 Link to comment Share on other sites More sharing options...
vekia Posted July 9, 2014 Share Posted July 9, 2014 go to preferences > seo & urls and try to define new page with your controller after that regenerate class_index file once again Link to comment Share on other sites More sharing options...
zalafa Posted July 9, 2014 Author Share Posted July 9, 2014 go to preferences > seo & urls and try to define new page with your controller after that regenerate class_index file once again Yes i created the seo & urls for that page Deleted class_index and regenerated the new one, but still couldn't display http://zalafa.com/index.php?controller=CekResi Link to comment Share on other sites More sharing options...
vekia Posted July 9, 2014 Share Posted July 9, 2014 hello in fact - it works http://zalafa.com/index.php?controller=CekResi page is blank it means that there can be some errors in the code in your class please turn on error reporting Link to comment Share on other sites More sharing options...
zalafa Posted July 9, 2014 Author Share Posted July 9, 2014 hello in fact - it works http://zalafa.com/index.php?controller=CekResi page is blank it means that there can be some errors in the code in your class please turn on error reporting Hi Vekia, Is this the correct way to turn error reporting in prestashop 1.6 from your link http://cart-help.com/topic/60-error-reporting-prestashop-16-15-14-13/ prestashop above v1.5.3 open: config/defines.inc.php find this line: define('_PS_MODE_DEV_', false); change to look like this: define('_PS_MODE_DEV_', true); Link to comment Share on other sites More sharing options...
zalafa Posted July 9, 2014 Author Share Posted July 9, 2014 Ok then i opened http://zalafa.com/index.php?controller=CekResi and get Fatal error: Class 'CekResi' not found in /home/zalafaco/public_html/classes/controller/Controller.php on line 135 Link to comment Share on other sites More sharing options...
vekia Posted July 9, 2014 Share Posted July 9, 2014 that's right it's correct use this controller name: (class name) class CekResiControllerCore extends FrontController { Link to comment Share on other sites More sharing options...
zalafa Posted July 9, 2014 Author Share Posted July 9, 2014 (edited) Yes i have changed that class name in 2 locations /overrides/controllers/front/ and /controllers/front/, cleared all cache, force smarty compiled, deleted & regenerated index_cache but still http://zalafa.com/index.php?controller=CekResi Edited July 9, 2014 by zalafa (see edit history) Link to comment Share on other sites More sharing options...
zalafa Posted July 12, 2014 Author Share Posted July 12, 2014 i have changed my file name to CekResiController.php too but still the same Link to comment Share on other sites More sharing options...
zalafa Posted July 12, 2014 Author Share Posted July 12, 2014 (edited) btw here is my controller CekResiController.php code at those 2 places class CekResiControllerCore 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_.'cek-resi.tpl'); } } and here is my tpl file, cek-resi.tpl inside public_html/themes/default-bootstrap cek resi disini {php}echo "sdf";{/php} Edited July 12, 2014 by zalafa (see edit history) Link to comment Share on other sites More sharing options...
zalafa Posted July 13, 2014 Author Share Posted July 13, 2014 that's right it's correct use this controller name: (class name) class CekResiControllerCore extends FrontController { Vekia ok what do you mean by "use this controller name: (class name)" i am quite confused.. Link to comment Share on other sites More sharing options...
zalafa Posted July 15, 2014 Author Share Posted July 15, 2014 btw here is my controller CekResiController.php code at those 2 places class CekResiControllerCore 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_.'cek-resi.tpl'); } } and here is my tpl file, cek-resi.tpl inside public_html/themes/default-bootstrap cek resi disini {php}echo "sdf";{/php} silly i don't put php tags "<?php ?>" zzz.. thanks vekia Link to comment Share on other sites More sharing options...
Araviel Posted October 11, 2014 Share Posted October 11, 2014 (edited) I followed a lot of tutorials of this thing to create a custom page but a 404 remains, and when I include my page in SEO URLS i've that : http://www.araclouds.com/index.php?controller=SliderAtoMods [Debug] This page has movedPlease use the following URL instead: http://www.araclouds.com/index.php?controller=atomods ... and when i click a 404 again. so there is my SliderAtoModsController.php <?php class SliderAtoModsControllerCore extends FrontController { public $php_self = 'atomods'; public function init() { parent::init(); } public function initContent() { parent::initContent(); $this->setTemplate(_PS_THEME_DIR_.'modatos.tpl'); } } ?> I tried to delete the class_index.php everytime I made a change but nothing. I need help, thanks in advance. Edited October 11, 2014 by Araviel (see edit history) Link to comment Share on other sites More sharing options...
fransjaeger Posted January 28, 2015 Share Posted January 28, 2015 (edited) Hi there Thanks for sharing this, it helped me alot today I got a suplymentary question: How to add parent site to breadcrumb ? Lets say I want my custom page to appear as child of My Account, how is that done? resulting in : Home > My Account > Custom Page Edited January 28, 2015 by michaelhjulskov (see edit history) Link to comment Share on other sites More sharing options...
fransjaeger Posted January 28, 2015 Share Posted January 28, 2015 Hi there Thanks for sharing this, it helped me alot today I got a suplymentary question: How to add parent site to breadcrumb ? Lets say I want my custom page to appear as child of My Account, how is that done? resulting in : Home > My Account > Custom Page Think its done like this: {capture name=path} <a href="{$link->getPageLink('my-account', true)|escape:'html':'UTF-8'}"> {l s='My account'} </a> <span class="navigation-pipe"> {$navigationPipe} </span> <span class="navigation_page"> {l s='Custom Page'} </span> {/capture} Link to comment Share on other sites More sharing options...
zelakioui Posted April 19, 2015 Share Posted April 19, 2015 Hello,I have the same problem but when i create module page I have created my own module in prestashop 1.6, but module page doesn't shown, prestashop gives me page not found . My frontController is : class PrcustomeropinionDefaultModuleFrontController extends ModuleFrontController{ public function init() { $this->page_name = 'opinion'; // page_name and body id $this->display_column_left = true; $this->display_column_right = true; parent::init(); } public function initContent() { parent::initContent(); $this->setTemplate('form.tpl'); }} form.tpl is in views/templates/front folder Please, i need your help !!! Link to comment Share on other sites More sharing options...
Henry Nainggolan Posted December 7, 2017 Share Posted December 7, 2017 https://www.packtpub.com/books/content/using-front-controllers-create-new-page Link to comment Share on other sites More sharing options...
ongeurPresta Posted February 2, 2018 Share Posted February 2, 2018 Hello geys this solution work perfectlly with override also. 1/ in the folder /override create page manufacturer-detail.php and put this code: include(dirname(FILE).'/config/config.inc.php'); Controller::getController('ManufacturerDetailController')->run(); Tools::displayFileAsDeprecated(); include(dirname(FILE).'/header.php'); $smarty->display(_PS_THEME_DIR_.'manufacturer-detail.tpl'); include(dirname(FILE).'/footer.php'); 2/ In the folder /override/controllers/front create page manufacturerDetailController.php and put this code: class ManufacturerDetailController extends FrontController{ /*public $php_self = 'manufacturer-detail'; */ /* optional */ public function init(){ parent::init(); } public function initContent(){ parent::initContent(); $this->setTemplate(_PS_THEME_DIR_.'manufacturer-detail.tpl'); } /* The following code portion is optional. * Remove the double-slashes to activate the portion * if you want to use external stylesheet and JavaScript for the page. * Create the CSS and JS files in the css and js directories of the theme accordingly */ //public function setMedia(){ //parent::setMedia(); //$this->addCSS(_THEME_CSS_DIR_.'custom-page.css'); //$this->addJS(_THEME_JS_DIR_.'custom-page.js'); //} } 3/ in the folder /themes/your-default-theme create page manufacturer-detail.php and put this code: Hello world 4/ You can go to SEO & URLs in your back office and add new url You can access tou your page http://yourstore.com/index?controller=ManufacturerDetail OR http://yourstore.com/urr-you-have-added-from-back-office Link to comment Share on other sites More sharing options...
ciepolml Posted May 15, 2019 Share Posted May 15, 2019 Solution in other post 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