我是 Prestashop 模組開發的新手。我正在嘗試建立艾米的第一個 prestashop 模組[參考:這是我的程式碼。我按照該教程中的說明進行了所有操作 https://devdocs.prestashop-project.org/8/modules/creation/tutorial/ 但仍然有問題'無法安裝模組我的。該模組無效,無法載入。 ”環境 PHP:7.4, Prestahop: 8.1.0
<?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 = 'Firstname Lastname';
$this->need_instance = 0;
$this->ps_versions_compliancy = [
'min' => '1.7.0.0',
'max' => '8.99.99',
];
$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 (Shop::isFeatureActive()) {
Shop::setContext(Shop::CONTEXT_ALL);
}
return (
parent::install()
&& Configuration::updateValue('MYMODULE_NAME', 'my module')
);
}
public function uninstall()
{
return (
parent::uninstall()
&& Configuration::deleteByName('MYMODULE_NAME')
);
}
}
我做了教程中所寫的所有內容。我確實希望它將我的自訂模組安裝到 prestashop。
我不知道我是否可以提供幫助,但請嘗試檢查您的 php 檔案是否與“$this->name = 'mymodule';”中的“mymodule”相同