Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 522 Vote(s) - 3.62 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Prestashop 1.7 unable to display custom module

#1
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
Reply

#2
Your steps are all right.
To make a reminder, to create a 'custom' module we should do:

<ol>
<li>Create a folder in modules folder, e.g. named `mycustommodule`</li>
<li>Create a php file named like the folder, e.g. `mycustommodule.php`</li>
<li>Then the "bootstrap" class (and construct) should be like this:</li>
</ol>


<?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?)

[![Categories menu][1]][1]

otherwise you can find it by searching:

[![Search input][2]][2]


[1]:

[2]:
Reply

#3
I had the same problem on version 1.7.4

I solved the problem by commenting the following line in the file

>\src\PrestaShopBundle\Controller\Admin\ModuleController.php

$filters = new AddonListFilter();
$filters->setType(AddonListFilterType::MODULE | AddonListFilterType::SERVICE);
// ->removeStatus(AddonListFilterStatus::UNINSTALLED);
$installedProducts = $moduleRepository->getFilteredList($filters);

I don't know why we can't see the uninstalled module
Reply

#4
Today I encountered the same problem in Prestashop 1.7.6.1. Found 2 solutions to the problem:

1. 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

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.

Reply

#5
Just go to module catalog instead of Modules Manager, and you will find your custom modules.

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through