Prestashop 1.7模块管理操作视图不起作用

时间:2017-08-01 17:46:11

标签: module namespaces prestashop admin prestashop-1.7

我创建了一个管理模块来管理新表的数据。该列表显示在后台。我想为每一行创建一个详细视图,但“视图”操作不起作用!我出现了这个错误:

  

AdminController.php第1632行中的ClassNotFoundException:尝试使用   从全局命名空间加载类“指南”。你忘记了“使用”吗   声明?

    require_once _PS_MODULE_DIR_.'mymodguides/classes/Guides.php';

class AdminMyModGuidesController extends ModuleAdminController
{
    protected $_pagination = array(20, 50, 100, 300, 1000);
    protected $_default_pagination = 20;

    public function __construct(){
        $this->table = 'guides';
        $this->identifier = 'id_guide';
        $this->className = 'Guides';
        $this->module = 'mymodguides';
        $this->fields_list = array(
            'id_guide' => array('title' => $this->l('ID'), 'align' => 'center','width' => 30),
            'name' => array('title' => $this->l('Name'), 'align' => 'center','width' => 150),
            'professional' => array('title' => $this->l('Prof'), 'align' => 'center','width' => 30),
            'ranking' => array('title' => $this->l('Ranking'), 'align' => 'center','width' => 30),
            'active' => array('title' => $this->l('Active'), 'align' => 'center','width' => 30),
            'date_add' => array('title' => $this->l('Date'), 'align' => 'center','width' => 30)
        );

        $this->bootstrap = true;
        parent::__construct();

        $this->_select = "CONCAT(c.`firstname` ,' ', c.`lastname` ) as name";
        $this->_join = 'LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`fk_id_customer`)';

        // Add actions
        $this->addRowAction('view');
    }

    public function renderView(){
        $tpl = $this->context->smarty->createTemplate(_PS_MODULE_DIR_.'mymodguides/views/templates/admin/view.tpl');
        return $tpl->fetch();
    }

    protected function l($string, $class = null, $addslashes = false, $htmlentities = true)
    {
        if ( _PS_VERSION_ >= '1.7') {
            return Context::getContext()->getTranslator()->trans($string);
        } else {
            return parent::l($string, $class, $addslashes, $htmlentities);
        }
    }

}

有没有人遇到过这个问题? 谢谢

0 个答案:

没有答案