在 prestashop 中安装模块时出现错误

时间:2021-01-31 23:23:27

标签: module shopify prestashop

每当我尝试安装下面的模块时,我都会收到一个错误:×您没有配置此模块的权限。

注意。该模块是从 Prestashop 迁移到 shopify

感谢您的帮助 这是模块的代码:

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

class ShopifyExport extends Module
{
    const CONTROLLER_CLASS = 'AdminExportToShopify';

    protected $config_form = false;

    protected $minimum_php_version;

    public function __construct()
    {
        $this->name = 'shopifyexport';
        $this->tab = 'export';
        $this->version = '1.2.2';
        $this->author = 'Shopify';
        $this->need_instance = 0;

        $this->bootstrap = true;

        parent::__construct();

        $this->displayName = $this->l('Export for Shopify');
        $this->description = $this->l('Export your store\'s data for an easy migration to Shopify.');

        $this->minimum_php_version = '5.5';
        $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
    }

    public function install()
    {return true;
        if (!parent::install() || !$this->checkPhpVersion()) {
            return false;
        }
        $this->installController();

    }

    private function installController()
    {
        $this->uninstallController();

        $parentTabId = Tab::getIdFromClassName('Configure');
        if (!$parentTabId) {
            $parentTabId = Tab::getIdFromClassName('Default');
        }
        $tab = new Tab();
        $tab->icon = 'cloud_download';
        $tab->class_name = self::CONTROLLER_CLASS;
        $tab->id_parent = $parentTabId;
        $tab->module = $this->name;
        foreach (Language::getLanguages(false) as $lang) {
            $tab->name[(int)$lang['id_lang']] = $this->displayName;
        }
        $tab->save();
    }

    public function uninstall()
    {
        $this->uninstallController();
        return parent::uninstall();
    }

    public function uninstallController()
    {
        $tabId = TabCore::getIdFromClassName(self::CONTROLLER_CLASS);
        if ($tabId) {
            $tab = new Tab($tabId);
            $tab->delete();
        }
    }

    public function getContent()
    {
        Tools::redirectAdmin($this->context->link->getAdminLink(self::CONTROLLER_CLASS));
    }

    private function checkPhpVersion()
    {
        if (version_compare(phpversion(), $this->minimum_php_version, '<')) {
            $this->_errors[] = Tools::displayError('The version of your module requires PHP 5.5 or higher.');
            return false;
        }
        return true;
    }
}

如果我尝试激活我的模块,我总是看到这个错误:

×You do not have permission to configure this module.

我使用的是 Prestashop 1.6.0.14 版

1 个答案:

答案 0 :(得分:0)

这看起来更像是权限问题而不是模块中的代码问题。

尝试卸载/重新安装模块以修复用户权限和/或确保您的员工个人资料具有对该模块的“配置”权限(查看ps_module_access表)。