Rhobur Posted May 29, 2013 Share Posted May 29, 2013 (edited) Hi, I have read all I could find about creating a new page in PS 1.5+. Unfortunately I cannot make it work. I am trying to create a new page following this thread, http://www.prestasho...ost__p__1170809, too but i get an error "The website encountered an error while retrieving http://www.caprice-s...certificatcadou. It may be down for maintenance or configured incorrectly." Here is what I did: 1. Created FrontController.php to override/classes/controller/front <?php class FrontController extends FrontControllerCore { public function init() { parent::init(); $this--->context->smarty->assign('currentController', get_class($this)); } } 2. Created certificatcadou.php in / : require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); Tools::redirect('index.php?controller=certificatcadou'.($_REQUEST ? '&'.http_build_query($_REQUEST, '', '&') : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); 3. Created certificatcadou.tpl in /themes/mytheme : {include file="$tpl_dir./breadcrumb.tpl"} {include file="$tpl_dir./errors.tpl"} <h1>Testpage</h1> controller: {$CertificatCadouController} 4. Created CertificatCadouController.php in /controllers/front/ : <?php class CertificatCadouControllerCore extends FrontController { public $php_self = 'certificatcadou'; public function initContent() { parent::initContent(); $this->setTemplate(_PS_THEME_DIR_.'certificatcadou.tpl'); } } 5. Added In PS admin > Prefrences > SEO & URLs Add new > Page = certificatcadou , Title = Certificat Cadou , Friendly URL = certificatcadou Still no luck!! Can you advise what could be wrong? Robert Edit: enabling error messaging I have found : Fatal error: Class 'CertificatCadouController' not found in /home/sites/caprice-shop.ro/public_html/classes/controller/Controller.php on line 128 What is this? Shouls I move the new Controller file to /classes/controller/? Edited May 29, 2013 by Caprice (see edit history) Link to comment Share on other sites More sharing options...
Banack Posted August 22, 2013 Share Posted August 22, 2013 At point 5, didd you select the right (certificatcadou) controller? Link to comment Share on other sites More sharing options...
Rhobur Posted August 22, 2013 Author Share Posted August 22, 2013 Yes, I did! Anyway, I gave back and made a CMS page to solve the problem. I cannot mark this issue as solved because it is not. Just circumvented it :-) Thanks for your interest! Link to comment Share on other sites More sharing options...
bellini13 Posted August 22, 2013 Share Posted August 22, 2013 I would first remove the FrontController override. It does not seem necessary. In your theme template file, remove the following, the variable $CertificatCadouController does not exist. Also, I noticed the link to the new page does not match the name of the page (icertificatcadou != certificatcadou) Everything else looks right Link to comment Share on other sites More sharing options...
Coldh4x Posted January 28, 2014 Share Posted January 28, 2014 Sorry for replying to an old thread, but this just happened to me. Here's how I solved it. In file /classes/Dispatcher.php around line 251 you'll find a switch case statement: case self::FC_FRONT : //Some code here break; Just above the break; insert the following: if(!class_exists($controller_class)) { include_once(_PS_FRONT_CONTROLLER_DIR_."/".$controller_class.".php"); } So it looks something like this: case self::FC_FRONT : //Some code here if(!class_exists($controller_class)) { include_once(_PS_FRONT_CONTROLLER_DIR_."/".$controller_class.".php"); } break; What this will do is include the class (if it hasn't been included yet), getting rid of the "Class X not found" error. Link to comment Share on other sites More sharing options...
JasonWang Posted April 4, 2014 Share Posted April 4, 2014 I suggest delete /cache/class_index.php and try again. Link to comment Share on other sites More sharing options...
kra Posted April 30, 2015 Share Posted April 30, 2015 Thanks JasonWang I have rename the cache/class_index.php .and it works 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