dsfsdf7852 2014-08-20 10:46 采纳率: 100%
浏览 38
已采纳

Prestashop - 如何在后台添加Tab的内容

Hi i have an issue with prestashop module, I've just created module called TestModule and in install method I got following code:

public function install() {
        $parent_tab = new Tab();
        foreach (Language::getLanguages(true) as $lang) {
            $parent_tab->name[$lang['id_lang']] = 'TestModule';
        }
        $parent_tab->class_name = 'TestModule';
        $parent_tab->id_parent = 0;
        @copy(_PS_MODULE_DIR_ . $this->name . '/logo.png', _PS_IMG_DIR_ . 't/TestModule.png');
        $parent_tab->module = $this->name;
        $parent_tab->add();
        if (!parent::install()) {
            return false;
        }
        return true;
    }

And it created the Tab "TestModule", but when I'm clicking on it there is the information that "Controller not found". How can I set some content here?

  • 写回答

1条回答 默认 最新

  • dqh1992 2014-08-21 19:06
    关注

    See this bellow code , it will help you you made mistake

                $langs = Language::getLanguages();
                $id_lang = (int)Configuration::get('PS_LANG_DEFAULT');
                $smarttab = new Tab();
                $smarttab->class_name = "AdminSmartBlog";
                $smarttab->module = "";
                $smarttab->id_parent = 0;
                foreach($langs as $l){
                        $smarttab->name[$l['id_lang']] = $this->l('Blog');
                }
                $smarttab->save();
                $tab_id = $smarttab->id;
                @copy(dirname(__FILE__)."/AdminSmartBlog.gif",_PS_ROOT_DIR_."/img/t/AdminSmartBlog.gif");
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?