1

我创建了一个自定义组件,用于实现自定义电子商务功能。管理员可以查看和管理来自后端的所有订单。需要的是每当管理员删除/取消任何订单邮件发送到该客户电子邮件 ID 时。我想知道如何覆盖或将我的代码添加到邮件到 deletelist 方法,以便在管理员仅删除订单记录时发送邮件。

4

1 回答 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:

  1. Override the controller's remove task by either overriding the remove method:

    class MycomponentControllerMycontroller extends JControllerAdmin{
    
        public function remove() {
            //stuff goes here
        }
    }
    
  2. Register the remove task in the cont

    class MycomponentControllerMycontroller extends JControllerAdmin{
        public function __construct($config = array())
        {
            parent::__construct($config);
            //...
            $this->registerTask('remove', 'myMethod');
    
        }
    
        public function myMethod() {
            //stuff goes here
        }
    }
    
  3. provide the $task argument to override the remove 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 回答