Jump to content

Prestashop 1.5 : custom content in admin tab within a module without model & table


Recommended Posts

Hello everybody,


I'm trying to implement a module using the new MVC pattern available on admin part of Prestashop. The thing is, ulike some tuto found on the web, I don't have any database table or model linked to it. So far I'm quite infortunate because I manage to set up an admin tab linked with my controller, but for some reason I cannot overload the form.tpl.


Here below is my module archive. It's very small an I would be eternally grateful if someone could just have a llok at it and make this admin tab display the form.tpl in the views folder. At least, any pointing in right direction would be deeply appreciated...


Thanks again guys !



Link to comment
Share on other sites

Hi there,

Small update for my topic with further explanations : all tutorials online show how to display database related content on admin tabs.

What if, like me you want to offer differents interactions than classical CRUD? My goal is to allow user to upload a file with an input type=file tag.


I tried to put it in the form.tpl of ma module admin tab, but as you know without any success. Do you have any idea why my form.tpl is not taken as an original form.tpl override?


SO many thanks for you guys if you take just 5 secs to look at my small module... ;)





Link to comment
Share on other sites

  • 4 weeks later...



First sorry for my English, second, I'm newbie in prestashop, but I need the same for my project.


In your zip you have a folder views inside the folder views of root. (Good -> ModuleFolder/views/templates/front...).


But I do the same with right structure and not work. The following code is OK, but I do not know if it's the best way.


The file for admin tab is : ModuleFolder\controllers\admin\AdminOrderBySupplier.php


Attention to the name of the classe, has word Controller in the end.


class AdminOrderBySupplierController extends AdminController {
public function __construct()
	$this->lang = (!isset($this->context->cookie) || !is_object($this->context->cookie)) ? intval(Configuration::get('PS_LANG_DEFAULT')) : intval($this->context->cookie->id_lang);
public function display(){
public function renderList() {
	$supplierArray = $this->getSuppliers();
	return $this->context->smarty->fetch(dirname(__FILE__).'/../../views/templates/admin/initial.tpl');
private function getSuppliers() {
	return Supplier::getSuppliers();


The code for install module: (Attention on register tab, casesensitive on $tabClass)


class OrderBySupplier extends Module {
public function __construct(){
	$this->name	 = 'orderbysupplier';
	$this->tab	  = 'checkout';
	$this->version = '1.0';
	$this->author   = "Rubén";
	$this->displayName = $this->l('Orders by supplier');
	$this->description = $this->l('Orders by supplier is a module that ...');
public function install() {
	return parent::install()
		&& $this->installModuleTab('AdminOrderBySupplier', array(1=>'Orders by supplier', 4=>'Pedidos por distribuidor'), 10);
public function uninstall(){
	return parent::uninstall()
		&& $this->uninstallModuleTab('AdminOrderBySupplier');
private function installModuleTab($tabClass, $tabName, $idTabParent)
	@copy(_PS_MODULE_DIR_.$this->name.'/logo.png', _PS_IMG_DIR_.'t/'.$tabClass.'.png');
	$tab = new Tab();
	$tab->name = $tabName;
	$tab->class_name = $tabClass;
	$tab->module = $this->name;
	$tab->id_parent = $idTabParent;
		return false;
	return true;
private function uninstallModuleTab($tabClass)
	$idTab = Tab::getIdFromClassName($tabClass);
	if($idTab != 0)
		$tab = new Tab($idTab);
		@unlink( _PS_IMG_DIR."t/".$tabClass.".png");
		return true;
	return false;

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...