Jump to content

Create a front controller


Recommended Posts

you have two ways to creating a custom front controller
1. using override

simple create a controller in override/controllers/front/YourController.php

for references you can check the core controllers in controllers/front/

after creating the controller you have to delete the file cache/class_index.php - this to be done to detect your newly created controller file

2. create a module front controller

create your own module and a module front controller


class YourmoduleCustomModuleFrontController extends ModuleFrontController {

    public function initContent() {

    public function setMedia() {



here the template file should be yourmodule/views/templates/front/my-template.tpl

and you can use the setMedia method only if you have custom js or css files to be loaded for your specific page, if not please remove it. 

and you can access this page using this url

when friendly url is enabled - yourdomain/module/yourmodule/custom

when friendly url is off  - yourdomain/index.php?controller=fc&module=yourmodule&fc=custom



Edited by GoFenice (see edit history)
  • Thanks 2

Share this post

Link to post
Share on other sites

Google can be your friend: https://belvg.com/blog/prestashop-1-7-mvc-part-2-creating-a-controller.html

class mymoduleMycontrollerModuleFrontController extends ModuleFrontController
	public function initContent()
			'hello' => 'Hello World!!!',


Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More