andref Posted October 19, 2016 Share Posted October 19, 2016 Hello there, I'm making a module to add a custom page to my store, I've got the module and page working as I want with url_rewrite disabled. But I want to use friendly url's, for this I activated them and added the page in BO->SEO&URLS with title and rewrite slug, but it's not working, I get a 404 error and the url changes. I tried a bunch of direferent things and research for hours online, so this is my last hope. (Just to mention, I got the page working before activating the friendly url's) Now some code; I'm using PrestaShop 1.6 Module PHP file: <?php if (!defined('_PS_VERSION_')) { exit; } class InCustomPages extends Module { public function __construct() { $this->name = 'incustompages'; $this->tab = 'front_office_features'; $this->version = '1.0.0'; $this->author = 'Andre Forte'; $this->need_instance = 0; $this->ps_version_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); $this->bootstrap = true; parent::__construct(); $this->displayName = $this->l('In Custom Pages'); $this->description = $this->l('Custom Pages for SempreIn.'); $this->confirmationUninstall = $this->l('Are you sure you want to uninstall?'); } public function install() { if (!parent::install()) return false; return true; } public function uninstall() { if (!parent::uninstall()) return false; return true; } } My Controller PHP: <?php class incustompagesNewsletterModuleFrontController extends ModuleFrontController { public $php_self = 'newsletter'; public function init() { $this->page_name = 'newsletter'; $this->display_column_left = false; parent::init(); } public function initContent() { parent::initContent(); $this->setTemplate('newsletter.tpl'); } public function setMedia() { parent::setMedia(); $this->addCSS(__PS_BASE_URI__.'modules/'.$this->module->name.'/css/'.$this->module->name.'.css'); } } I've added the page in BO->SEO & URLs with proper title and url rewrite "newsletter" The url should work like www.mysite.com/newsletter But it doesn't, I get a 404 error and the url changes to www.mysite.com/index.php?controller=newsletter&module=incustompages I hope I was clear on my problem and hope someone can help me out. Thank you in advance! Link to comment Share on other sites More sharing options...
andref Posted October 19, 2016 Author Share Posted October 19, 2016 That did it! When we think we're doind the right thing and it just isn't needed... Thank you so much! Link to comment Share on other sites More sharing options...
Thymotep Posted August 7, 2018 Share Posted August 7, 2018 Hello, Where is the solution of your problem? I have same problem but i don't find the solution and you seem to have found a solution. Thanks, Thymotep 1 Link to comment Share on other sites More sharing options...
mrthrust Posted July 24, 2019 Share Posted July 24, 2019 On 10/19/2016 at 5:41 PM, andref said: That did it! When we think we're doind the right thing and it just isn't needed... Thank you so much! what did it? for the love of all things, please include how you fixed it? 1 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