如何在PrestaShop中向当前索引添加新参数?

时间:2016-06-16 08:46:14

标签: php prestashop prestashop-1.6

如何在PrestaShop中为管理页面(管理员自定义模块)的当前索引添加新参数?

我尝试了以下操作,但它无效:

$this->setcurrentindex=$this->setcurrentindex.'&view=querydrlog';

我需要的是:

http://localhost/raffleV1.3/oknr9hexztcseff5/index.php?controller=query&view=querydrlog&token=d81fcd49d179ae13444df0e8b2cccec6

当我点击USL的asc或分页部分时:

http://localhost/raffleV1.3/oknr9hexztcseff5/index.php?controller=query&kits_query_drOrderby=id_query_dr&kits_query_drOrderway=desc&token=d81fcd49d179ae13444df0e8b2cccec6

在上述网址中,我想添加'&view=querydrlog';,以便我的分页和asc能够正常使用。

2 个答案:

答案 0 :(得分:2)

You can do it in your module admin controller by overriding the init() function of AdminController.

class YourAdminModuleController extends ModuleAdminController {
    protected $extra_params = '&view=querydrlog';

    public function init() {
        parent::init();
        self::$currentIndex .= $this->extra_params;
        $this->context->smarty->assign('current', self::$currentIndex);
    }
}

This will add your parameter to sorting link hrefs or pagination form action link.

答案 1 :(得分:0)

像@TheDrot 但更简单:

class YourAdminModuleController extends ModuleAdminController {
    protected $extra_params = '&view=querydrlog';

    public function initProcess() {
        self::$currentIndex .= $this->extra_params;
        parent::initProcess();
    }
}