Class 在 prestashop 的 classes/controller/Controller.php 中找不到
Class not found in classes/controller/Controller.php in prestashop
我在我的模块中添加了选项卡
我的模块看起来像:
class CustomerClub extends Module
{
public function __construct()
{
$this->name = 'customerclub';
$this->tab = 'pricing_promotion';
$this->version = '1.0.0';
$this->author = 'me';
$this->need_instance = 0;
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
$this->controllers = array(
'AdminCustomerClub',
);
$this->bootstrap = true;
parent::__construct();
$this->tabs = array();
$this->tabs[] = array(
'class_name' => 'AdminCustomerClub',
'id_parent' => 0,
'name' => $this->l('custmer club'),
'visible' => true,
);
$this->displayName = $this->l('Customer Club');
$this->description = $this->l('Manage Customer Club ');
$this->confirmUninstall = $this->l('Are you sure you want to uninstall?');
if (!Configuration::get('CUSTOMER_CLUB'))
$this->warning = $this->l('No name provided');
}
public function install()
{
if (Shop::isFeatureActive())
Shop::setContext(Shop::CONTEXT_ALL);
if (!parent::install() ||
!Configuration::updateValue('CUSTOMER_CLUB', 'customer club') ||
!$this->installModuleTab()
)
return false;
return true;
}
public function installModuleTab()
{
foreach ($this->tabs as $myTab) {
if (!Tab::getIdFromClassName($myTab['class_name'])) {
$tab = new Tab();
$tab->class_name = $myTab['class_name'];
$tab->module = $this->name;
if (isset($myTab['parent_class_name'])) {
$tab->id_parent = Tab::getIdFromClassName($myTab['parent_class_name']);
} else {
$tab->id_parent = 0;
// $tab->id_parent = -1;
}
$tab->name = array();
$languages = Language::getLanguages(ture);
foreach ($languages as $lang) {
$tab->name[$lang['id_lang']] = $myTab['name'];
}
$tab->add();
}
}
return true;
}
}
我的管理模块扩展控制器 class 是这样的:
在:controllers/admin/AdminCustomerClubController.php
class AdminCustomerClubController extends ModuleAdminController
{
public function __construct()
{
$this->module = 'customerclub'; //refers to your module's $this->name = 'productarticle';
$this->bootstrap = true;
$this->context = Context::getContext();
parent::__construct();
}
public function init()
{
parent::init();
}
//
public function initContent()
{
parent::initContent();
$this->setTemplate('output.tpl');
}
}
我还有一个文件在:
views/templates/admin/output.tpl
菜单已创建,但当我单击它时显示以下错误:
Fatal error: Uncaught Error: Class 'AdminCustomerClubController' not found in /home/host/public_html/classes/controller/Controller.php:138 Stack trace: #0 /home/host/public_html/classes/Dispatcher.php(359): ControllerCore::getController('AdminCustom...') #1 /home/admin/public_html/admincp/index.php(58): DispatcherCore->dispatch() #2 {main} thrown in /home/host/public_html/classes/controller/Controller.php on line 138
我确实删除了cache/class_index.php,但并没有解决错误
Fatal error: Uncaught Error: Class 'AdminCustomerClubController' not found in /home/host/public_html/classes/controller/Controller.php:138 Stack trace: #0 /home/host/public_html/classes/Dispatcher.php(359): ControllerCore::getController('AradCustom...') #1 /home/arad2papcoiran/public_html/admincp/index.php(58): DispatcherCore->dispatch() #2 {main} thrown in /home/host/public_html/classes/controller/Controller.php on line 138
在这个特定的错误中,我看到了:
ControllerCore::getController('AradCustom...') #1
您的错误实际上不能链接到此自定义控制器,PrestaShop 在您访问 AdminTab 时尝试加载吗?
此致,
出现问题是因为我更改了选项卡 class 名称,并且在接下来的 运行 中没有在数据库上覆盖它,所以我更改了数据库中的值并且事情开始起作用
我在我的模块中添加了选项卡 我的模块看起来像:
class CustomerClub extends Module
{
public function __construct()
{
$this->name = 'customerclub';
$this->tab = 'pricing_promotion';
$this->version = '1.0.0';
$this->author = 'me';
$this->need_instance = 0;
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
$this->controllers = array(
'AdminCustomerClub',
);
$this->bootstrap = true;
parent::__construct();
$this->tabs = array();
$this->tabs[] = array(
'class_name' => 'AdminCustomerClub',
'id_parent' => 0,
'name' => $this->l('custmer club'),
'visible' => true,
);
$this->displayName = $this->l('Customer Club');
$this->description = $this->l('Manage Customer Club ');
$this->confirmUninstall = $this->l('Are you sure you want to uninstall?');
if (!Configuration::get('CUSTOMER_CLUB'))
$this->warning = $this->l('No name provided');
}
public function install()
{
if (Shop::isFeatureActive())
Shop::setContext(Shop::CONTEXT_ALL);
if (!parent::install() ||
!Configuration::updateValue('CUSTOMER_CLUB', 'customer club') ||
!$this->installModuleTab()
)
return false;
return true;
}
public function installModuleTab()
{
foreach ($this->tabs as $myTab) {
if (!Tab::getIdFromClassName($myTab['class_name'])) {
$tab = new Tab();
$tab->class_name = $myTab['class_name'];
$tab->module = $this->name;
if (isset($myTab['parent_class_name'])) {
$tab->id_parent = Tab::getIdFromClassName($myTab['parent_class_name']);
} else {
$tab->id_parent = 0;
// $tab->id_parent = -1;
}
$tab->name = array();
$languages = Language::getLanguages(ture);
foreach ($languages as $lang) {
$tab->name[$lang['id_lang']] = $myTab['name'];
}
$tab->add();
}
}
return true;
}
}
我的管理模块扩展控制器 class 是这样的: 在:controllers/admin/AdminCustomerClubController.php
class AdminCustomerClubController extends ModuleAdminController
{
public function __construct()
{
$this->module = 'customerclub'; //refers to your module's $this->name = 'productarticle';
$this->bootstrap = true;
$this->context = Context::getContext();
parent::__construct();
}
public function init()
{
parent::init();
}
//
public function initContent()
{
parent::initContent();
$this->setTemplate('output.tpl');
}
}
我还有一个文件在: views/templates/admin/output.tpl
菜单已创建,但当我单击它时显示以下错误:
Fatal error: Uncaught Error: Class 'AdminCustomerClubController' not found in /home/host/public_html/classes/controller/Controller.php:138 Stack trace: #0 /home/host/public_html/classes/Dispatcher.php(359): ControllerCore::getController('AdminCustom...') #1 /home/admin/public_html/admincp/index.php(58): DispatcherCore->dispatch() #2 {main} thrown in /home/host/public_html/classes/controller/Controller.php on line 138
我确实删除了cache/class_index.php,但并没有解决错误
Fatal error: Uncaught Error: Class 'AdminCustomerClubController' not found in /home/host/public_html/classes/controller/Controller.php:138 Stack trace: #0 /home/host/public_html/classes/Dispatcher.php(359): ControllerCore::getController('AradCustom...') #1 /home/arad2papcoiran/public_html/admincp/index.php(58): DispatcherCore->dispatch() #2 {main} thrown in /home/host/public_html/classes/controller/Controller.php on line 138
在这个特定的错误中,我看到了:
ControllerCore::getController('AradCustom...') #1
您的错误实际上不能链接到此自定义控制器,PrestaShop 在您访问 AdminTab 时尝试加载吗?
此致,
出现问题是因为我更改了选项卡 class 名称,并且在接下来的 运行 中没有在数据库上覆盖它,所以我更改了数据库中的值并且事情开始起作用