Hi i'm new to prestashop and i try to create an admin module to 1.7. I would create a new menu to display a template and manage my DB.
modules/mymodule/mymodule.php :
<?php
if (!defined('_PS_VERSION_'))
{
exit;
}
class MyModule extends Module
{
public function __construct()
{
$this->name = 'mymodule';
$this->tab = 'administration';
$this->version = '1.0.0';
$this->author = 'John doe';
$this->bootstrap = true;
parent::__construct();
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
$this->displayName = $this->l('Mon module');
$this->description = $this->l('On test la creation de module presta.');
}
public function install()
{
// Install Tabs
$tab = new Tab();
$tab->active = 1;
$tab->class_name = "MyModule";
$tab->module = 'mymodule';
$tab->name = array();
$tab->id_parent = (int)Tab::getIdFromClassName('SELL');
$tab->position = 3;
foreach ($lang as $l) {
$tab->name[$l['id_lang']] = $this->l('Mon module');
}
$tab->add();
if (!parent::install())
return false;
return true;
}
public function uninstall()
{
// Uninstall Tabs
$tab = new Tab((int)Tab::getIdFromClassName('Mymodule'));
$tab->delete();
// Uninstall Module
if (!parent::uninstall())
return false;
return true;
}
}
module/mymodule/controller/admin/MyModuleController.php :
<?php
class MyModuleController extends ModuleAdminController
{
public function renderList() {
$this->content = $this->createTemplate('mymodule.tpl')->fetch();
return $this->content;
}
}
?>
modules/mymodule/views/templates/admin/mymodule.tpl:
{block name="page_title"}
{l s='Mon module'}
{/block}
<section >
<div>Hello world !</div>
</section>
I create this with a compilation of a lot of tutorials 1.7 / 1.6 but the installation fail. Prestashop provide us a documentation to create a first module but it's not really documented and i find nothing really helpfull on internet yet for 1.7.
Any help/suggestions ?
Thanks
EDIT1 : ok, the install is correct, my tab is created but when i click on it it calls "controller=MyModule" and the module controller is not found. Almost finished.
install()method. - TheDrot