Reputation: 1451
I overrieded a controller in Prestashop 1.7 like this :
/override/controllers/front/MyAccountController.php
class MyAccountController extends MyAccountControllerCore
{
/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
$this->context->smarty->assign([
'logout_url' => $this->context->link->getPageLink('index', true, null, 'mylogout')
]);
parent::initContent();
$this->setTemplate("module:configurateur/views/templates/front/my-account.tpl");
}
}
So I'm trying to call a view in my custom module "configurateur" with this line :
$this->setTemplate("module:configurateur/views/templates/front/my-account.tpl");
This file exists and is in the right folder (I think) :
\modules\configurateur\views\templates\front\my-account.tpl
When I try to load the page, I have this error :
No template found for module:configurateur/views/templates/front/my-account.tpl at line 68 in file classes/Smarty/TemplateFinder.php
Can anyone tell my what's wrong please ?
Upvotes: 1
Views: 1971
Reputation: 471
The syntax "module:..." is only for ModuleFrontController objects, not for FrontController :
In your case your should use the hook DisplayOverrideTemplate or redirect the page myaccount to a module controller.
Upvotes: 1