Heim  >  Fragen und Antworten  >  Hauptteil

Problem bei der Prestashop-Installation: Das benutzerdefinierte Modul kann nicht installiert werden

Ich bin neu in der Prestashop-Modulentwicklung. Ich versuche, Amys erstes Prestashop-Modul zu erstellen [Referenz: Hier ist mein Code. Ich habe alle Anweisungen in diesem Tutorial https://devdocs.prestashop-project.org/8/modules/creation/tutorial/ befolgt, habe aber immer noch das Problem „Mein Modul konnte nicht installiert werden“. Das Modul ist ungültig und kann nicht geladen werden. „Umgebung 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')
        );
    }
}

Ich habe alles gemacht, was im Tutorial geschrieben wurde. Ich möchte, dass mein benutzerdefiniertes Modul in Prestashop installiert wird.

P粉330232096P粉330232096180 Tage vor413

Antworte allen(1)Ich werde antworten

  • P粉893457026

    P粉8934570262024-04-04 14:00:31

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

    Antwort
    0
  • StornierenAntwort