我创建了一个自定义组件,用于实现自定义电子商务功能。管理员可以查看和管理来自后端的所有订单。需要的是每当管理员删除/取消任何订单邮件发送到该客户电子邮件 ID 时。我想知道如何覆盖或将我的代码添加到邮件到 deletelist 方法,以便在管理员仅删除订单记录时发送邮件。
问问题
2013 次
1 回答
3
As the documentation says, the JToolbarHelper::deleteList
/**
* JToolbarHelper/deleteList
* Writes a common 'delete' button for a list of records.
*
* @param string $msg Postscript for the 'are you sure' message.
* @param string $task An override for the task.
* @param string $alt An override for the alt text.
*
* @return void
*
* @since 1.5
*/
Therefore, you have several options:
Override the controller's
remove
task by either overriding theremove
method:class MycomponentControllerMycontroller extends JControllerAdmin{ public function remove() { //stuff goes here } }
Register the
remove
task in the contclass MycomponentControllerMycontroller extends JControllerAdmin{ public function __construct($config = array()) { parent::__construct($config); //... $this->registerTask('remove', 'myMethod'); } public function myMethod() { //stuff goes here } }
provide the
$task
argument to override theremove
task.toolbar button creation:
JToolbarHelper::deleteList('', 'mycontroller.myMethod', 'JTOOLBAR_EMPTY_TRASH');
and the controller:
class MycomponentControllerMycontroller extends JControllerAdmin{ public function myMethod() { //stuff goes here } }
The controller in this example should be located in in administrator/components/mycomponent/controllers/mycontroller
.
于 2013-08-14T13:49:29.150 回答