安装 prestashop 模块时出现问题:mymodule(class missing in /...)
Issue installing prestashop module : mymodule(class missing in /...)
我是 prestashop 模块开发的新手,我似乎无法让它工作。我一步一步地按照教程进行操作,但是当我安装模块时,我总是得到这个 "Mymodule (class missing in /modules/Mymodule/test-module.php)".
我在网上查了一下,似乎当 php 文件没有用没有 BOM 的 UTF-8 编码时会发生这个错误,但即使这样做也不起作用。
这是我的代码,希望有人能找到问题所在:
<?php
if (!defined('_PS_VERSION_'))
exit;
class CookiesPresta extends Module {
public function __construct() {
$this->name = 'CookiesPresta';
$this->tab = 'front_office_features';
$this->version = '1.0';
$this->author = 'me myself';
$this->need_instance = 0;
$this->ps_versions_compliancy = array('min' => '1.5');
$this->dependencies = array();
parent::__construct();
$this->displayName = $this->l('Bandeau Cookies');
$this->description = $this->l('Créez et personnalisez votre bandeau d\'information sur les cookies');
$this->confirmUninstall = $this->l('Voulez vous désinstaller le module Bandeau Cookies');
if (!Configuration::get('cookiespresta'))
$this->warning = $this->l('No name provided');
}
public function install() {
if (!parent::install()
|| !$this->registerHook('displayHeader')
|| !$this->registerHook('displayFooter')
)
return false;
return true;
}
public function uninstall() {
if(parent::uninstall())
return false;
return true;
}
}
?>
我建议您使用 Prestashop 的 generator 创建标准模块
如果你的模块 Class 名称 CookiesPresta
你应该命名目录 /cookiespresta
和你的 Class 文件 /cookiespresta/cookiespresta.php
我是 prestashop 模块开发的新手,我似乎无法让它工作。我一步一步地按照教程进行操作,但是当我安装模块时,我总是得到这个 "Mymodule (class missing in /modules/Mymodule/test-module.php)".
我在网上查了一下,似乎当 php 文件没有用没有 BOM 的 UTF-8 编码时会发生这个错误,但即使这样做也不起作用。
这是我的代码,希望有人能找到问题所在:
<?php
if (!defined('_PS_VERSION_'))
exit;
class CookiesPresta extends Module {
public function __construct() {
$this->name = 'CookiesPresta';
$this->tab = 'front_office_features';
$this->version = '1.0';
$this->author = 'me myself';
$this->need_instance = 0;
$this->ps_versions_compliancy = array('min' => '1.5');
$this->dependencies = array();
parent::__construct();
$this->displayName = $this->l('Bandeau Cookies');
$this->description = $this->l('Créez et personnalisez votre bandeau d\'information sur les cookies');
$this->confirmUninstall = $this->l('Voulez vous désinstaller le module Bandeau Cookies');
if (!Configuration::get('cookiespresta'))
$this->warning = $this->l('No name provided');
}
public function install() {
if (!parent::install()
|| !$this->registerHook('displayHeader')
|| !$this->registerHook('displayFooter')
)
return false;
return true;
}
public function uninstall() {
if(parent::uninstall())
return false;
return true;
}
}
?>
我建议您使用 Prestashop 的 generator 创建标准模块
如果你的模块 Class 名称 CookiesPresta
你应该命名目录 /cookiespresta
和你的 Class 文件 /cookiespresta/cookiespresta.php