frankit Posted November 15, 2013 Share Posted November 15, 2013 Hi there, I'm trying to create a custom page extending the FrontController class and still can't find where the issue is. here's my files: controllers/front/CustomerCareController.php: <?php class CustomerCareControllerCore extends FrontController { public $php_self = 'customercare'; public function initContent() { parent::initContent(); $this->setTemplate(_PS_THEME_DIR_.'customercare.tpl'); } } themes/[myTheme]/customercare.tpl: {capture name=path}{l s='CustomerCare'}{/capture} {include file="$tpl_dir./breadcrumb.tpl"} <div> hello! </div> /customercare.php: <?php require(dirname(__FILE__).'/config/config.inc.php'); Tools::displayFileAsDeprecated(); Tools::redirect('index.php?controller=customercarecontroller'.($_REQUEST ? '&'.http_build_query($_REQUEST, '', '&') : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); Caching is disabled, template cache is in forced compile, and class_index.php deleted and regenerated. When I try to reach the url "index.php?controller=customercarecontroller" or "customercare.php" the most of the page loads fine (i mean header, footer and stuff) but i get: "This webpage is not avalable, We're sorry, but the Web address you've entered is no longer available." so obviosly no div containg "hello!" . I'm getting quite crazy, what am I doing wrong?! Tank you in advance. Link to comment Share on other sites More sharing options...
PascalVG Posted November 16, 2013 Share Posted November 16, 2013 No sure if it works, but looking at the samples in / folder and controller/front/xxx, maybe try this: Tools::redirect('index.php?controller=customer-care'.($_REQUEST ? The first letter seems to be capitalised automatically, the '-' between customer-care seems to be deleted and then the next letter seems to be capitalised. the 'controller' will be appended automatically. Just a try, though, never played with it! :-) pascal. Link to comment Share on other sites More sharing options...
frankit Posted November 18, 2013 Author Share Posted November 18, 2013 No sure if it works, but looking at the samples in / folder and controller/front/xxx, maybe try this: Tools::redirect('index.php?controller=customer-care'.($_REQUEST ? The first letter seems to be capitalised automatically, the '-' between customer-care seems to be deleted and then the next letter seems to be capitalised. the 'controller' will be appended automatically. Just a try, though, never played with it! :-) pascal. Thank you so much, it worked! In the meantime I managed to make the new page as a module page, following this howto (http://nemops.com/creating-new-pages-in-prestashop/) in wich it's explained that this method is "much more consistent" then add a page simply as a new controller. But I really can't figure out why. May I ask wich are the advantages of create custom pages within an empty module? 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