在prestashop中覆盖帮助器列表页脚

时间:2015-07-02 17:51:43

标签: prestashop helper prestashop-1.6

我想更改管理产品操作批量,所以我正在创建一个模块来执行此操作, 在我的模块中,我没有任何控制器,我重写了adminProductsController,我想覆盖ADMIN / themes / default / template / helpers / list / footer_list.tpl,我试图把它放在/ override / controllers /下admin / templates / helpers / list,但我得到了默认模板。

在Helper.php中

public function createTemplate($tpl_name)
{
    var_dump($this->override_folder);
    var_dump($this->module);

    exit;

    if ($this->override_folder)
    {
        if ($this->context->controller instanceof ModuleAdminController)
            $override_tpl_path = $this->context->controller->getTemplatePath().$this->override_folder.$this->base_folder.$tpl_name;
        elseif ($this->module)
            $override_tpl_path = _PS_MODULE_DIR_.$this->module->name.'/views/templates/admin/_configure/'.$this->override_folder.$this->base_folder.$tpl_name;
        else
        {
            if (file_exists($this->context->smarty->getTemplateDir(1).$this->override_folder.$this->base_folder.$tpl_name))
                $override_tpl_path = $this->context->smarty->getTemplateDir(1).$this->override_folder.$this->base_folder.$tpl_name;
            elseif (file_exists($this->context->smarty->getTemplateDir(0).'controllers'.DIRECTORY_SEPARATOR.$this->override_folder.$this->base_folder.$tpl_name))
                $override_tpl_path =   $this->context->smarty->getTemplateDir(0).'controllers'.DIRECTORY_SEPARATOR.$this->override_folder.$this->base_folder.$tpl_name;

        }
    }
    elseif ($this->module)
        $override_tpl_path = _PS_MODULE_DIR_.$this->module->name.'/views/templates/admin/_configure/'.$this->base_folder.$tpl_name;

我为$ this-> override_folder获取NULL,我试过

$helper->override_folder = $this->tpl_folder;

在AdminController.php中,renderList函数。

任何人都可以提供帮助吗? 谢谢。

1 个答案:

答案 0 :(得分:0)

我通过在override / controllers / admin / templates / products / helpers / list

中添加文件解决了这个问题