ClavoLike
Prestashop Developer
Vipul Hadiya is an Indian expert Prestahop and Wordpress developer having 4+ years of experience of working with clients of almost 22 countries around the world.
At Konjali
P.O. Box: 364290
Mahuva, Gujarat
364290
India
vip@vipulhadiya.com
09712670188
DOB: 07/27/1991

Create New Page in Prestashop Using Front Controller

This tutorial will lead you to create a new page similar to Product, Category, Homepage in your Prestashop store using your own custom Prestashop module. To get successful result follow each instruction strictly as i am going to show in this tutorial.

Create Module Directory Structure

This is important part of Prestashop module development for any kind of Prestashop module. Create module directory in following pattern. Here module name is ‘listproducts’ so my module directory name will be same.

  • listproducts
    • controllers
      • front
        • list.php
    • views
      • templates
        • front
          • list.tpl
    • listproduct.php
    • logo.png

Module file code:

Following is the code for main file of module listproducts – listproducts.php. If you have seen my previous tutorials of this series then following code is not hard to understand. Here, only new line is $this->controllers = array(‘list’);. Our module is going to create a new page so we have only one new controller. If we are going to create more pages than you need to create same number of controllers.

Code for listproducts/controllers/front/list.php

In this file check name of class listproductsListModuleFrontController. It looks tedious but it is really easy and you must have to follow the naming rules strictly. Let me explain how it is generated.
{modulename}{controller}ModuleFrontController is the correct syntax for front controller of module. In our case module name is listproducts and we have created controller named list. As per regulation of Prestashop we need to follow camel case syntax so our class name will be listproductsListModuleFrontController.

Code for listproducts/views/front/list.tpl

You need to focus on listproducts/controllers/front/list.php where in initContent() function there is a function for setting template file for new page. Try to make same name for /controllers/front/list.php and views/templates/front/list.tpl

Once you install the module successfully then you can access this page by this link http://yourdomain.com/module/listproducts/list. In this link after http://yourdomain.com/module/ first parameter is name of module and next if name of controller.

To change this URL open your back-end admin dashboard and set new URL from Preferences -> SEO & URL

In next part we will print some meaningful data on page we created.

About Vipul Hadiya

Vipul Hadiya is full time Prestashop and Wordpress Developer. Active at both job and freelancing on Upwork.com (formerly oDesk). He has interest to share Prestahsop tutorials for beginners.

3 comments

  1. Hello sir,

    I need your help I have a website of prestashop my requirement when we create a category and subcategory. can I add a custom url in subcategory and redirect of that subcategory where I want .

    how to ek custom line in menu with custom page where I want to display some table info.

    thanks

  2. Do you have any hooks or modules for order filtering based on admin login?

Leave a Reply

Your email address will not be published. Required fields are marked *

*