创建的Prestashop 1.5

问题描述:

我的PrestaShop 1.5 贸文件mymodule.php内容创建的Prestashop 1.5

<?php 
    if (!defined('_PS_VERSION_')) 
   exit; 
  
    class myModule extends Module 
   { 
   public function __construct() 
     { 
     $this->name = 'mymodule'; 
     $this->tab = 'Test'; 
     $this->version = 1.0; 
     $this->author = 'Firstname Lastname'; 
     $this->need_instance = 0; 
  
     parent::__construct(); 
  
     $this->displayName = $this->l('My module'); 
     $this->description = $this->l('Description of my module.'); 
     } 
  
   public function install() 
    { 
    if (parent::install() == false) 
      return false; 
    return true; 
    } 
    public function uninstall() 
    { 
    if (!parent::uninstall()) 

    parent::uninstall(); 
    } 
   } 
?> 

创建一个新的模块,模块,但我有一个错误味精

mymodule中(ERREUR德syntaxe丹斯/模块/ mymodule中/ mymodule.php) mymodule中(CLASSE manquante丹斯/modules/mymodule/mymodule.php)

你可以自己lp请

+1

请张贴本网站上的英文错误信息(只需添加一个翻译所以很清楚这是什么意思)。谢谢。 – hakre

+0

只需要说一句:语法应该是“class MyModule extends Module”而不是“class myModule extends Module”。 – Anila

当你的类文件中只有语法错误时,经常出现这个错误。的Prestashop无法加载类文件,因此,无法加载模块

你可以尝试在命令行启动 php -l mymodule.php 时,我发现可能的语法错误在PHP文件

这个问题就解决了更改页面的编码(以不含BOM的UTF-8编码)。

+0

可以解释得更好。你做了什么网页? –

您是否为该模块创建了一个config.xml文件?还有另外一件事......在prestashop中没有 “测试”选项卡。将其更改为有效的选项卡属性。 http://doc.prestashop.com/display/PS15/Creating+a+PrestaShop+module 此链接可以帮助你。

+0

添加config.xml文件为我工作。 (使用v1.6) – BlastFire

我会选择类名与模块名相同。

class mymodule(){ 

Mymodule中

而且你写

if (!parent::uninstall()) 
     parent::uninstall(); 

意义,如果卸载有错误,你用武力unninstall? 我认为,这是更好地

if(parent::uninstall()) 
      return false; 
    return true;