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粉8934570262024-04-04 14:00:31
I don't know if I can help, but try checking if your php file is the same as "mymodule" in "$this->name = 'mymodule';"