Prestashop安装问题:无法安装自定义模块
P粉330232096
P粉330232096 2024-04-03 19:24:44
[PHP讨论组]

我是 Prestashop 模块开发的新手。我正在尝试构建艾米的第一个 prestashop 模块[参考:这是我的代码。我按照该教程中的说明进行了所有操作 https://devdocs.prestashop-project.org/8/modules/creation/tutorial/ 但仍然有问题'无法安装模块我的。该模块无效,无法加载。”环境 PHP:7.4, Prestahop: 8.1.0

<?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 = 'Firstname Lastname';
        $this->need_instance = 0;
        $this->ps_versions_compliancy = [
            'min' => '1.7.0.0',
            'max' => '8.99.99',
        ];
        $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 (Shop::isFeatureActive()) {
            Shop::setContext(Shop::CONTEXT_ALL);
        }

        return (
            parent::install()
            && Configuration::updateValue('MYMODULE_NAME', 'my module')
        );
    }
    public function uninstall()
    {
        return (
            parent::uninstall()
            && Configuration::deleteByName('MYMODULE_NAME')
        );
    }
}

我做了教程中所写的所有内容。我确实希望它将我的自定义模块安装到 prestashop。

P粉330232096
P粉330232096

全部回复(1)
P粉893457026

我不知道我是否可以提供帮助,但请尝试检查您的 php 文件是否与“$this->name = 'mymodule';”中的“mymodule”相同

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号