I'm trying prestashop 1.7 and I have an issue with the creation of custom modules. I have created a folder "mymodule" inside the "modules" folder, and, as it is indicate in the documentation I've created a simple mymodule.php file in it :
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
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 = array('min' => '1.6', 'max' => _PS_VERSION_);
$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');
}
}
?>
Then I go on the administration page under "modules" -> "modules & services" on the "installed module" tab, but I can't find my module...
What error am I doing?
Thanks
Xavier
Your steps are all right. To make a reminder, to create a 'custom' module we should do:
<?php
if (!defined('_PS_VERSION_'))
exit;
class MyCustomModule extends Module
{
public function __construct()
{
$this->name = 'mycustommodule'; /* This is the 'technic' name, this should equal to filename (mycustommodule.php) and the folder name */
$this->tab = 'module type category'; /* administration, front_office_features, etc */
$this->version = '1.0.0'; /* Your module version */
$this->author = 'Firstname Lastname'; /* I guess it was clear */
$this->need_instance = 0; /* If your module need an instance without installation */
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); /* Your compatibility with prestashop(s) version */
$this->bootstrap = true; /* Since 1.6 the backoffice implements the twitter bootstrap */
parent::__construct(); /* I need to explain that? */
$this->displayName = $this->l('My module'); /* This is the name that merchant see */
$this->description = $this->l('Description of my module.'); /* A short description of functionality of this module */
$this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); /* This is a popup message before the uninstalling of the module */
}
}
?>
Then for prestashop 1.7.x.x you have to go in Modules
and in the Selection
tab click on 'Categories' and find your module (remember the $this->tab snippet?)
otherwise you can find it by searching:
Today I encountered the same problem in Prestashop 1.7.6.1. Found 2 solutions to the problem:
Zip your module and upload it using Prestashop backoffice. Not good if for example you use git to upload changes. So I keep searching, and found solution no 2
If you create a custom module it appears in Module -> Catalog not in Modules -> Modules & Services tab... Very strange and counter intuitive behavior. After you install this module everything works as expected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With