Jump to content

what shold i write in ModuleFrontController page for my custom module


Genie

Recommended Posts

create file named "display.php" in (full path) /modules/YOUR_MODULE/controllers/front/display.php

 

with contents:

replace "mymodule"  in class name with name of your module

<?php
class mymoduledisplayModuleFrontController extends ModuleFrontController
{
  public function initContent()
  {
    parent::initContent();
    $this->setTemplate('display.tpl');
  }
}
  • Like 1
Link to comment
Share on other sites

Hello Vekia

Thanks for your reply. When i am writing the above code th mymodules display.php page it is showing Fatal error: Class 'ModuleFrontController' not found in C:\xampp\htdocs\pestashop_test\modules\mymodule\display.php on line 4

That's why i wanted to know where to write ModuleFrontController and what to write in it.

Thanks

Jenie

Link to comment
Share on other sites

  • 4 months later...

Hi Genie/ALL,

 

I face the same problem as yours,

Did you find a solution for your problem?

I followed all steps mentioned in this official documentation: http://doc.prestashop.com/display/PS16/Displaying+content+on+the+front-office

all things work well up to reaching the section "Embedding a template in the theme".

In fact, I get a fatal error and my apache error log mention the following error:

"[sat Nov 29 23:03:40.405937 2014] [:error] [pid 25895] [client 41.230.241.227:32878] PHP Fatal error:  Class 'documentsenderdisplayModuleFrontController' not found in /var/www/clients/client1/web1/web/prestashop/classes/controller/Controller.php on line 135"

 

Note that myModule is called documentsender

 

I created the mentioned folder structure under modules folder. MyModule is called "documentsender"

see the joinded file to see all the content of my module folder

 

Please assist me to bypass this fatal error.

 

Cordially,

Mohamed Belhassen

documentsender.tar.gz

Link to comment
Share on other sites

Hi Genie/ALL,

 

I face the same problem as yours,

Did you find a solution for your problem?

I followed all steps mentioned in this official documentation: http://doc.prestashop.com/display/PS16/Displaying+content+on+the+front-office

all things work well up to reaching the section "Embedding a template in the theme".

In fact, I get a fatal error and my apache error log mention the following error:

"[sat Nov 29 23:03:40.405937 2014] [:error] [pid 25895] [client 41.230.241.227:32878] PHP Fatal error:  Class 'documentsenderdisplayModuleFrontController' not found in /var/www/clients/client1/web1/web/prestashop/classes/controller/Controller.php on line 135"

 

Note that myModule is called documentsender

 

I created the mentioned folder structure under modules folder. MyModule is called "documentsender"

see the joinded file to see all the content of my module folder

 

Please assist me to bypass this fatal error.

 

Cordially,

Mohamed Belhassen

 

Hi All,

I found the solution.

In fact the official documentation is a little bit unclear about the location of the TPL file.

In the first sight, I thought that the TPL should be in the same folder as the PHP file: i.e. MyModule/controllers/front

but after googling, I found a post that mention that the TPL have to be placed in the following folder: MyModule/views/templates/front

 

Cordially,

Mohamed Belhassen

  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...