2017-03-17 9 views
1

Ich versuche Prestashop 1.7 und ich habe ein Problem mit der Erstellung von benutzerdefinierten Modulen. Ich habe einen Ordner „mymodule“ innerhalb der „Module“ Ordner erstellt, und, wie es in der Dokumentation anzuzeigen, ich habe eine einfache mymodule.php Datei in ihm erstellt:Prestashop 1.7 kann kein benutzerdefiniertes Modul anzeigen

<?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'); 
    } 
} 

?> 

Dann gehe ich auf der Verwaltungsseite unter "Module" -> "Module & Dienste" auf der Registerkarte "installiertes Modul", aber ich finde mein Modul nicht ...

Welchen Fehler mache ich?

Dank

Xavier

+0

Wenn Sie das Modul nicht installiert haben, wird es nicht in der Registerkarte des installierten Moduls angezeigt. Sie sollten auf der ersten Registerkarte suchen. Vergessen Sie auch nicht, die Funktion zum Installieren und Deinstallieren hinzuzufügen. – sadlyblue

Antwort

5

Ihre Schritte sind alles in Ordnung. Um eine Erinnerung zu machen, ein ‚custom‘ Modul erstellen wir tun sollten:

  1. einen Ordner in Module Ordner erstellen, zum Beispiel namens `mycustommodule`
  2. Erstellen Sie eine PHP-Datei mit dem Namen des Ordners, z. `Mycustommodule.php`
  3. die "Bootstrap" Klasse Dann (und konstruieren) so sein sollte:
<?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 */ 
    } 
} 
?> 

Dann für Prestashop 1.7.xx Sie in Modules und in der Selection Registerkarte klicken gehen auf 'Kategorien' und das Modul (erinnere mich an die $ this-> Registerkarte Schnipsel?) finden

Categories menu

sonst hat man es durch die Suche finden:

Search input

Verwandte Themen