Reputation: 1929
How to create a new page in prestashop admin panel? <- this is the closest thing I found, but this question is not a duplicate.
How to create a back office module page along with it's contents (paragraph and input controls) from the module itself without the need to actually put a template file by FTP? User should need to do anything apart from installing the module to get a backoffice menu entry leading to the created page.
Upvotes: 0
Views: 806
Reputation: 1273
In the function install()
$this->installModuleTab('Name on menu (ex: My module action)', 'Module (ex: MyModule)', Tab::getIdFromClassName('name of files module (ex: myAdminModule.php)')))
In the module :
private function installModuleTab($tabClass = null, $tabName = null, $idTabParent = 0)
{
$pass = true;
$tabNameLang = array();
if (Tab::getIdFromClassName($tabClass))
return (true);
@AmazonTools::copy(_PS_MODULE_DIR_.$this->name.'/images/a16.gif', _PS_IMG_DIR_.'t/'.$tabClass.'.gif');
foreach (Language::getLanguages() as $language)
$tabNameLang[$language['id_lang']] = $tabName;
$tab = new Tab();
$tab->name = $tabNameLang;
$tab->class_name = $tabClass;
$tab->module = $this->name;
$tab->id_parent = (int)$idTabParent;
// For Prestashop 1.2
//
if (version_compare(_PS_VERSION_, '1.3', '<'))
$pass = $tab->add();
else
$pass = $tab->save();
return ($pass);
}
Regards,
Upvotes: 1