在prestashop中的class / controller / Controller.php中找不到类

时间:2018-12-10 13:18:39

标签: prestashop-1.6

我在模块中添加了标签 我的模块如下:

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;
    }

}

和我用于管理模块的扩展控制器类是这样的: 在: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');

    }
}

,我还有一个文件位于: 视图/模板/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,但无法解决错误

2 个答案:

答案 0 :(得分:0)

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时加载?

此致

答案 1 :(得分:0)

发生此问题是因为我更改了选项卡类名称,并且在下一次运行中没有在数据库上覆盖它,所以我更改了数据库中的值,一切开始起作用