样本Prestashop模块未出现安装

时间:2018-03-07 07:29:46

标签: prestashop prestashop-1.7

此示例来自Prestashop Dev Docs

<?php

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

class Helloworld extends Module {
    public function __construct()
    {
        $this->name = 'helloworld';
        $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');

        //$this->install();
    }

    public function install()
    {
        if (Shop::isFeatureActive())
            Shop::setContext(Shop::CONTEXT_ALL);

        if (!parent::install() ||
            !$this->registerHook('displayLeftColumn') ||
            !$this->registerHook('header') ||
            !Configuration::updateValue('MYMODULE_NAME', 'my friend')
        )
            return false;

        return true;
    }

    public function uninstall()
    {
        if (!parent::uninstall() ||
            !Configuration::deleteByName('MYMODULE_NAME')
        )
            return false;

        return true;
    }
}

只有强制取消注释$ this-&gt; install();内部构造函数。 当我对其进行调试时,我发现下面的操作将其从页面中删除:

if ($module->database->get('installed') == 1
        && $module->database->get('active') == 1
        && !$filter->hasStatus(AddonListFilterStatus::DISABLED)
        && $filter->hasStatus(AddonListFilterStatus::ENABLED)) 
    {
        unset($modules[$key]);
        continue;
    }

helloworld.php和logo.png位于/ modules / helloworld

所以问题很简单 - 如何在复制内容后通过管理面板(/admin-dev/index.php/module/manage)安装它?

我也尝试压缩并上传,但错误总是发生

  

UndefinedMethodException   HTTP 500内部服务器错误   试图调用名为&#34; validateValue&#34;的未定义方法。 class&#34; Symfony \ Component \ Validator \ Validator \ RecursiveValidator&#34;。

0 个答案:

没有答案