prestashop 1.7-简单的模块不起作用

时间:2018-07-16 13:43:49

标签: prestashop prestashop-1.7

我按照本文档章节中的说明创建了简单的模块:

http://doc.prestashop.com/display/PS17/Creating+a+first+module

这是我的文件/modules/steel/steel.php:

<?php

if (!defined('_PS_VERSION_'))
exit;

class Steel extends Module
{

public function __construct()
{
    $this->name = 'steel';
    $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_);

parent::__construct();

$this->displayName = 'xxx';
$this->description = 'desc';
$this->confirmUninstall = 'deinstall?';
}

public function install()
{
    return false;
  return true;
}

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

由于某种原因,它没有显示在模块列表中,因此我可以安装它。如果我将其放入zip文件并尝试使用“上传模块”功能进行安装,则会显示“模块钢的安装失败。模块无效且无法加载。”。

1 个答案:

答案 0 :(得分:2)

尝试一下:

<?php

if (!defined('_PS_VERSION_')) {
    exit;
}

class Steel extends Module
{

    public function __construct()
    {
        $this->name = 'steel';
        $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_);

        parent::__construct();

        $this->displayName = 'xxx';
        $this->description = 'desc';
        $this->confirmUninstall = 'deinstall?';
    }

    public function install()
    {
        return parent::install();
    }

    public function uninstall()
    {
        return parent::uninstall();
    }
}