如何将新参数添加到 PrestaShop 中的当前索引?
How do I add a new parameter to the current index in PrestaShop?
如何在 PrestaShop 的管理页面(管理自定义模块)的当前索引中添加新参数?
我尝试了以下方法,但没有用:
$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);
}
}
这会将您的参数添加到排序 link href 或分页表单操作 link。
像@TheDrot 但更简单:
class YourAdminModuleController extends ModuleAdminController {
protected $extra_params = '&view=querydrlog';
public function initProcess() {
self::$currentIndex .= $this->extra_params;
parent::initProcess();
}
}
如何在 PrestaShop 的管理页面(管理自定义模块)的当前索引中添加新参数?
我尝试了以下方法,但没有用:
$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);
}
}
这会将您的参数添加到排序 link href 或分页表单操作 link。
像@TheDrot 但更简单:
class YourAdminModuleController extends ModuleAdminController {
protected $extra_params = '&view=querydrlog';
public function initProcess() {
self::$currentIndex .= $this->extra_params;
parent::initProcess();
}
}