Reputation: 222
I have created a module named gestionfournisseur. I need to modify some part of frontend view in this module. For this, I had created two file:
1 - gestionfournisseur/controllers/front/display.php
: this file content my controller logic and herit ModuleFrontController
<?php
class gestionfournisseurdisplayModuleFrontController extends ModuleFrontController
{
public function initContent()
{
parent::initContent();
$this->setTemplate('display.tpl');
}
}
2 - gestionfournisseur/views/templates/front/display.tpl
: content the view I want to display.
Hello World!!
I generated the link to this page with the following instruction in my module main file:
$this->name = 'gestionfournisseur';
$this->context->link->getModuleLink($this->name,'display')
But, prestashop return me a big exception: No template found for display.tpl
If it can't help you, the content of my variable $this->context->smarty->getTemplateDir() look like this:
array:1 [▼
0 => "/my_hosts/manishop/themes/classic/templates/"
]
Please can't you tell me what is the problems?
Thank's
Upvotes: 1
Views: 6285
Reputation: 1317
You need to call setTemplate() function as shown below:
class SupercheckoutFcontModuleFrontController extends ModuleFrontController
{
public function initContent()
{
parent::initContent();
$this->setTemplate('module:supercheckout/views/templates/front/order_detail.tpl');
}
}
The order_detail.tpl file should contain the following code:
{extends file=$layout}
{block name='content'}
YOUR_HTML_CONTENT_HERE
{/block}
Upvotes: 5
Reputation: 222
After some times and some helps, I found the solution.
Firstly, you need to indicate you template like @ventura show in her answer:
$this->setTemplate('module:supercheckout/views/templates/front/order_detail.tpl');
Secondly, to include you template in layout page, you need to extend
the page
template like this:
{extends file='page.tpl'}
{block name="page_content"}
"trigger"
{/block}
Upvotes: 2
Reputation: 174
Maybe int this way
$this->setTemplate('module:supercheckout/views/templates/front/order_detail.tpl');
Upvotes: 0