Prestashop installation issue: Unable to install custom module
P粉330232096
P粉330232096 2024-04-03 19:24:44
0
1
412

I am new to Prestashop module development. I'm trying to build Amy's first prestashop module [Reference: Here is my code. I followed all the instructions in this tutorial https://devdocs.prestashop-project.org/8/modules/creation/tutorial/ but still have the problem 'Unable to install module mine'. The module is invalid and cannot be loaded. "Environment 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')
        );
    }
}

I did everything written in the tutorial. I do want it to install my custom module into prestashop.

P粉330232096
P粉330232096

reply all(1)
P粉893457026

I don't know if I can help, but try checking if your php file is the same as "mymodule" in "$this->name = 'mymodule';"

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!