Andrz2556 Posted July 23, 2023 Share Posted July 23, 2023 (edited) 0 I am new to Prestashop module development. I am trying to build my first prestashop module[ref: Here is my code.I did everything as in that tutorial written https://devdocs.prestashop-project.org/8/modules/creation/tutorial/ and still have a problem 'Cannot Install module My. The module is invalid and cannot be loaded.' Enviroment 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') ); } } Edited August 11, 2023 by Andrz2556 (see edit history) Link to comment Share on other sites More sharing options...
endriu107 Posted July 23, 2023 Share Posted July 23, 2023 At first try change this class MyModule extends Module to class Mymodule extends Module Link to comment Share on other sites More sharing options...
Andrz2556 Posted July 23, 2023 Author Share Posted July 23, 2023 Nothing changes Link to comment Share on other sites More sharing options...
endriu107 Posted July 24, 2023 Share Posted July 24, 2023 It should work, maybe this is cache issue so try clrear it. Link to comment Share on other sites More sharing options...
Andrz2556 Posted July 25, 2023 Author Share Posted July 25, 2023 Yes, everything works fine, thanks for the advice. If I have still question and problem, do you I need to create a new topic, or I might ask you here? Link to comment Share on other sites More sharing options...
endriu107 Posted July 25, 2023 Share Posted July 25, 2023 Forum rules https://www.prestashop.com/forums/topic/394154-read-first-forum-rules-and-best-practices/ 1 Topic = 1 Subject or 1 Question - If you have more than one question, open more than one new topic! - Do not ask your question on a thread that doesn’t deal with the exact same matter. Open a new thread, it’s alright to do so. 1 Link to comment Share on other sites More sharing options...
Andrz2556 Posted July 25, 2023 Author Share Posted July 25, 2023 Okay, thank you for the advice. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now