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");
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画