在产品中添加批量操作时如何在 prestashop 中添加 separator/divider
How to add a separator/divider in prestashop when adding bulk actions in Products
我正在为 Prestashop 编写一个模块,它覆盖 AdminProductsController 并向 BackOffice 的产品视图中的 批量操作 菜单添加另外两个操作。这是我在重写 class
的构造中添加批量操作的代码
public function __construct() {
parent::__construct();
$this->bulk_actions['exportSelected'] = array(
'text' => $this->l('Export selected'),
'icon' => 'icon-cloud-upload',
'confirm' => $this->l('Are you sure you want to export selected products ?')
);
$this->bulk_actions['exportAll'] = array(
'text' => $this->l('Export all'),
'icon' => 'icon-cloud-upload',
'confirm' => $this->l('Are you sure you want to export all products ?')
);
}
结果是这样
我想在删除所选内容和导出所选内容之间添加一个分隔符。我的意思是,将它添加到 before 我新添加的条目。我怎样才能做到这一点?
在添加操作之前添加分隔符。
public function __construct() {
parent::__construct();
/*
* $this->bulk_actions key can be anything except 'divider' as it already
* gets added for 'Enable/disabled selection'
* (and other already defined actions of course)
*/
$this->bulk_actions['my_actions_divider'] = array(
'text' => 'divider'
);
$this->bulk_actions['exportSelected'] = array(
'text' => $this->l('Export selected'),
'icon' => 'icon-cloud-upload',
'confirm' => $this->l('Are you sure you want to export selected products ?')
);
$this->bulk_actions['exportAll'] = array(
'text' => $this->l('Export all'),
'icon' => 'icon-cloud-upload',
'confirm' => $this->l('Are you sure you want to export all products ?')
);
}
我正在为 Prestashop 编写一个模块,它覆盖 AdminProductsController 并向 BackOffice 的产品视图中的 批量操作 菜单添加另外两个操作。这是我在重写 class
的构造中添加批量操作的代码public function __construct() {
parent::__construct();
$this->bulk_actions['exportSelected'] = array(
'text' => $this->l('Export selected'),
'icon' => 'icon-cloud-upload',
'confirm' => $this->l('Are you sure you want to export selected products ?')
);
$this->bulk_actions['exportAll'] = array(
'text' => $this->l('Export all'),
'icon' => 'icon-cloud-upload',
'confirm' => $this->l('Are you sure you want to export all products ?')
);
}
结果是这样
我想在删除所选内容和导出所选内容之间添加一个分隔符。我的意思是,将它添加到 before 我新添加的条目。我怎样才能做到这一点?
在添加操作之前添加分隔符。
public function __construct() {
parent::__construct();
/*
* $this->bulk_actions key can be anything except 'divider' as it already
* gets added for 'Enable/disabled selection'
* (and other already defined actions of course)
*/
$this->bulk_actions['my_actions_divider'] = array(
'text' => 'divider'
);
$this->bulk_actions['exportSelected'] = array(
'text' => $this->l('Export selected'),
'icon' => 'icon-cloud-upload',
'confirm' => $this->l('Are you sure you want to export selected products ?')
);
$this->bulk_actions['exportAll'] = array(
'text' => $this->l('Export all'),
'icon' => 'icon-cloud-upload',
'confirm' => $this->l('Are you sure you want to export all products ?')
);
}