Reputation: 575
I am new in Prestashop module development. I am trying to build amy first prestashop module[ref: http://doc.prestashop.com/display/PS16/Creating+a+first+module]. Here is my code
<?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 = 'Rohit Prakash';
$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');
}
public function install()
{
if (!parent::install())
return false;
return true;
}
public function uninstall()
{
if (!parent::uninstall())
return false;
return true;
}
}
when I am trying to install mymodule from back office then got an error message
"Error! Cannot install module mymodule. Unfortunately, the module did not return additional details."
help me please!!
Upvotes: 0
Views: 3849
Reputation: 8459
I'm a little bit late here but this worked for my case.
First, delete the last row from module table.
If table prefix is ps
and your module name is mymodule
, it will be stored in ps_module
table with column name
value mymodule
.
DELETE FROM `ps_module` WHERE `name` = "mymodule";
Next, delete roles from authorization role table.
Module installer automatically add CRUD roles for your module. Delete them from authorization_role
table.
Install your module again.
Environment: PHP7.2, Prestashop v1.7.6.4
Upvotes: 0
Reputation: 2987
you have an error. instead of the _construct()
it should be __construct()
.
Upvotes: 1