I am using prestashop 1.7 and have created a front-controller for my module. When I am using setTemplate, it does not include the header and footer just a blank page. I have assigned a page (in backoffice) to the module controller, and in the module, I am using following code:
/modules/somemodules/controllers/front/moduleslist.php:
class somemodulesmoduleslistModuleFrontController extends ModuleFrontController
{
public function initContent(){
$this->context->smarty->assign(array(
'id' => 1,
));
$this->setTemplate('module:somemodules/views/templates/front/find-modules.tpl');
}
}
What I have tried in the template file:
/modules/somemodules/views/templates/front/find-modules.tpl:
{extends file='page.tpl'}
{block name='page_content'}
{{$id}}
{/block}
But now errors is like, undifined language, undifined page etc. Is there a better way of doing this, rather than re-defining all of these?
You also have to call the parent method so that all standard variables get initialized.
public function initContent()
{
parent::initContent();
$this->context->smarty->assign(array(
'id' => 1,
));
$this->setTemplate('module:somemodules/views/templates/front/find-modules.tpl');
}