0

我是 Prestashop 模块开发的新手。我正在尝试构建 amy 第一个 prestashop 模块[参考:http://doc.prestashop.com/display/PS16/Creating+a+first+module]。这是我的代码

<?php
    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 = 'Rohit Prakash';
            $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');
        }

        public function install()
        {
          if (!parent::install())
            return false;
          return true;
        }

        public function uninstall()
        {
          if (!parent::uninstall())
            return false;
          return true;
        }
    }

当我尝试从后台安装 mymodule 时收到一条错误消息

“错误!无法安装模块 mymodule。不幸的是,该模块没有返回其他详细信息。”

请帮帮我!!

4

2 回答 2

1

你有一个错误。而不是_construct()它应该是__construct()

于 2017-03-01T09:42:35.697 回答
0

我在这里有点晚了,但这对我的情况有用。

  • 首先,从模块表中删除最后一行。

    如果表前缀是ps并且您的模块名称是mymodule,它将ps_module与列name值一起存储在表中mymodule

DELETE FROM `ps_module` WHERE `name` = "mymodule";
  • 接下来,从授权角色表中删除角色。

    模块安装程序会自动为您的模块添加 CRUD 角色。authorization_role从表中删除它们。

  • 再次安装您的模块。

环境:PHP7.2,Prestashop v1.7.6.4

于 2020-04-07T13:02:08.580 回答