Prestashop 1.7无法显示自定义模块
问题描述:
我正在尝试prestashop 1.7,并且创建自定义模块时遇到问题。 我创建了一个文件夹“MyModule的”“模块”文件夹内,并且,因为它是在文档中表示,我创建了一个简单mymodule.php文件吧:Prestashop 1.7无法显示自定义模块
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
if (!defined('_PS_VERSION_'))
exit;
class MyModule extends Module
{
public function __construct()
{
$this->name = 'mymodule';
$this->tab = 'front_office_features';
$this->version = '1.0.0';
$this->author = 'Firstname Lastname';
$this->need_instance = 0;
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('My module');
$this->description = $this->l('Description of my module.');
$this->confirmUninstall = $this->l('Are you sure you want to uninstall?');
if (!Configuration::get('MYMODULE_NAME'))
$this->warning = $this->l('No name provided');
}
}
?>
然后我去了管理页面下的“模块” - >“模块&服务”在“已安装的模块”选项卡上,但我找不到我的模块...
我在做什么错误?
感谢
泽维尔
答
你的步骤都没事。 要提醒,创建一个“自定义”模块中,我们应该做的:
- 创建模块的文件夹,例如文件夹命名为`mycustommodule`
- 创建一个名称与文件夹类似的php文件,例如`mycustommodule.php`
- 那么“引导”类(构建)应该是这样的:
<?php
if (!defined('_PS_VERSION_'))
exit;
class MyCustomModule extends Module
{
public function __construct()
{
$this->name = 'mycustommodule'; /* This is the 'technic' name, this should equal to filename (mycustommodule.php) and the folder name */
$this->tab = 'module type category'; /* administration, front_office_features, etc */
$this->version = '1.0.0'; /* Your module version */
$this->author = 'Firstname Lastname'; /* I guess it was clear */
$this->need_instance = 0; /* If your module need an instance without installation */
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); /* Your compatibility with prestashop(s) version */
$this->bootstrap = true; /* Since 1.6 the backoffice implements the twitter bootstrap */
parent::__construct(); /* I need to explain that? */
$this->displayName = $this->l('My module'); /* This is the name that merchant see */
$this->description = $this->l('Description of my module.'); /* A short description of functionality of this module */
$this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); /* This is a popup message before the uninstalling of the module */
}
}
?>
随后的Prestashop 1.7.xx你在Modules
并在Selection
选项卡中点击进入在“类别”,找到你的模块(记得$这个 - >标签片段?)
否则,你可以通过搜索找到它:
如果您尚未安装该模块,它将不会显示在已安装的模块选项卡中。你应该在第一个标签中找到它。另外,不要忘记添加安装和卸载功能。 – sadlyblue