Php 如何向PrestaShop中的当前索引添加新参数?
如何在PrestaShop中为管理员页面(管理员自定义模块)的当前索引添加新参数 我尝试了以下方法,但无效:Php 如何向PrestaShop中的当前索引添加新参数?,php,prestashop,prestashop-1.6,Php,Prestashop,Prestashop 1.6,如何在PrestaShop中为管理员页面(管理员自定义模块)的当前索引添加新参数 我尝试了以下方法,但无效: $this->setcurrentindex=$this->setcurrentindex.'&view=querydrlog'; 我需要的是: http://localhost/raffleV1.3/oknr9hexztcseff5/index.php?controller=query&view=querydrlog&token=d81fcd49d
$this->setcurrentindex=$this->setcurrentindex.'&view=querydrlog';
我需要的是:
http://localhost/raffleV1.3/oknr9hexztcseff5/index.php?controller=query&view=querydrlog&token=d81fcd49d179ae13444df0e8b2cccec6
当我单击asc
或分页部分时,USL是:
http://localhost/raffleV1.3/oknr9hexztcseff5/index.php?controller=query&kits_query_drOrderby=id_query_dr&kits_query_drOrderway=desc&token=d81fcd49d179ae13444df0e8b2cccec6
在上面的URL中,我想添加
'&view=querydrlog'
,这样我的分页和asc
将正常工作。您可以通过覆盖AdminController
的init()
函数在模块管理控制器中执行此操作
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);
}
}
这会将您的参数添加到排序链接hrefs或分页表单操作链接。您可以在模块管理控制器中通过重写
AdminController的init()
函数来完成此操作
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);
}
}
这会将您的参数添加到排序链接hrefs或分页表单操作链接。类似于@drot,但更简单:
class YourAdminModuleController extends ModuleAdminController {
protected $extra_params = '&view=querydrlog';
public function initProcess() {
self::$currentIndex .= $this->extra_params;
parent::initProcess();
}
}
类似于@drot,但更简单:
class YourAdminModuleController extends ModuleAdminController {
protected $extra_params = '&view=querydrlog';
public function initProcess() {
self::$currentIndex .= $this->extra_params;
parent::initProcess();
}
}