こんにちは、私はprestashopを初めて使いました。私は1.7への管理モジュールを作成しようとしています。 私は、テンプレートを表示し、私のDBを管理するための新しいメニューを作成します。Prestashop 1.7 create admin module
モジュール/ 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;
}
}
モジュール/ MyModuleという/制御/管理/ MyModuleController.php:
<?php
class MyModuleController extends ModuleAdminController
{
public function renderList() {
$this->content = $this->createTemplate('mymodule.tpl')->fetch();
return $this->content;
}
}
?>
モジュール/ MyModuleという/ビュー/テンプレート/管理/ MyModuleという。 tpl:
{block name="page_title"}
{l s='Mon module'}
{/block}
<section >
<div>Hello world !</div>
</section>
私は多くのチュートリアル1.7/1.6のコンパイルでこれを作成しますが、インストール 失敗します。 Prestashopは、最初のモジュールを作成するためのドキュメントを提供していますが、実際には文書化されていません。
ヘルプ/提案はありますか?
おかげ
EDIT1:OK、インストールは私のタブが作成され、正しいですが、私はそれをクリックしたときには、「コントローラ= MyModuleという」呼び出し、モジュールコントローラが見つかりません。ほとんど終わった。
あなたは 'install()'メソッドからtrueまたはfalseを返すわけではありません。 – TheDrot
@TheDrotありがとう、インストールはエラーを返さなかったが、私のメニューは表示されません。 –
エラーが生じますか? – TheDrot