Reputation: 2398
I want to create a custom module in prestashop but it does not show up in the modules-tab in the back-office.
I created a very basic test-module but even this does not show up in back-office.
I have a single text.php file in the folder: modules/test This is the code of the file:
<?php
if (!defined('_PS_VERSION_'))
exit;
class Test extends Module
{
public function __construct()
{
parent::__construct();
$this->name = 'Test';
$this->tab = 'Test';
$this->version = 1.0;
$this->author = 'Test';
$this->need_instance = 0;
$this->displayName = 'TEST';
$this->description = 'TEST';
}
public function install()
{
return (parent::install());
}
}
As far as I understand this is enough for a basic module to show up in the back-offices's modules tab.
Any idea what might be wrong?
Upvotes: 1
Views: 5088
Reputation: 1
What version of PS are you using? If < 1.5, seems that a stable and less bugged 1.4.10 was released few days ago. I am using 1.4.10 at my website Panapaná (http://www.panapana.com.br) and faced a similar problem when I was using 1.4.8.2. After migration to 1.4.10, this problem no longer exists.
Upvotes: 0
Reputation: 1511
Note the location of parent::__construct();
I think you are calling the parent before setting enough information. I would also suggest using a different name for your test module, something less generic.
<?php
if (!defined('_PS_VERSION_'))
exit;
class Test extends Module
{
public function __construct()
{
$this->name = 'Test';
$this->tab = 'Test';
$this->version = 1.0;
$this->author = 'Test';
$this->need_instance = 0;
parent::__construct();
$this->displayName = 'TEST';
$this->description = 'TEST';
}
public function install()
{
return (parent::install());
}
}
Upvotes: 0
Reputation: 1775
In your test module there can be a few reasons of that:
you need to have you name your file the same as folder so it would be test.php in modules/test folder
$this->name = 'test'; test should be lower-case as stated in Prestashop official guide 'name' attribute. Serves as an internal identifier, so make it unique, without special characters or spaces, and keep it lower-case.
Upvotes: 2