Jump to content

Bug in ModuleAdminController


Recommended Posts

Hi,
 
I'm not sure if it is a bug or not because I don't know if this is what you wanted to do or not, I think it is a bug because it doesn't make sense what you are supposed to do, maybe you could explain it to me. I will explain the situation.
 
I've created a new custom module for Prestashop 1.6. I have created a new Controller which extends ModuleAdminController inside the proper folder of the module. This would be the structure.  
 
modules/userSubscription/controllers/admin/AdminUserSubscriptionController.php
 
I can access to the controller through the proper URL in the admin area. 
 
Until here, all is ok. And now the problem/bug. In theory the template should be placed in this folder:
 
modules/userSubscription/views/templates/admin/usersSubscriptionAdmin.tpl
 
 
So that, in the initContent of the controller I've set the template ($this->setTemplate('userSubscription.tpl')
 
But when I access to the controller in the admin, I have an error, and it tells that the template is not found because it is looking for it in themes/default/template/
 
This is the first line of the error:
 
Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file '/home/****/domains/******.com/public_html/1b03d7a6fcacc82f3bb4d31689397850/admin-dev/themes/default/template/newfile.tpl'
 
So that, if you move the file in the path it is looking for,  all is working properly, but I think it shouldn't be like this, because all files should be in side the module.
 
Thanks for your attention.

 

 

 

Link to comment
Share on other sites

  • 8 months later...

solved my problem

	public function initContent()
	{
		$page = $this->createTemplate('module.tpl');
		$this->content = $page->fetch();
		parent::initContent();
	}

tpl should be placed MODULE/views/templates/admin/CONTROLLER_NAME/module.tpl

So not a bug, we just missplaced the file. And also I did not use the code correctyl until now.

Link to comment
Share on other sites

×
×
  • Create New...