简体   繁体   中英

Error PHP Call to undefined method ControllerModuleKonfirm::validateDelete()

can anyone please tell me what is causing this error ? Fatal error: Call to undefined method ControllerModuleKonfirm::validateDelete() i'm trying to run the delete function after user click on the button.. but this error appear.

this is my script:

<?php
class ControllerModuleKonfirm extends Controller {
private $error = array(); 

public function index() {   
    $this->language->load('module/konfirm');

    $this->load->model('catalog/konfirm');

    $this->document->setTitle($this->language->get('heading_title'));

    $this->getList();

}


public function delete() {
    $this->language->load('module/konfirm');

    $this->document->setTitle($this->language->get('heading_title'));

    $this->load->model('catalog/konfirm');

    if (isset($this->request->post['selected']) && $this->validateDelete()) {
        foreach ($this->request->post['selected'] as $id) {
            $this->model_catalog_konfirm->deletePaymentConfirmation($id);
        }

        $this->session->data['success'] = $this->language->get('text_success');

        $url = '';

        $this->redirect($this->url->link('catalog/konfirm', 'token=' . $this->session->data['token'] . $url, 'SSL'));
    }

    $this->getList();
}

protected function getList() {

    $url = '';
    $this->data['heading_title'] = $this->language->get('heading_title');

    $this->data['button_save'] = "Export";
    $this->data['button_delete'] = $this->language->get('button_delete');
    $this->data['button_cancel'] = $this->language->get('button_cancel');   

    if (isset($this->error['warning'])) {
        $this->data['error_warning'] = $this->error['warning'];
    } else {
        $this->data['error_warning'] = '';
    }

    $this->data['breadcrumbs'] = array();

    $this->data['breadcrumbs'][] = array(
        'text'      => $this->language->get('text_home'),
        'href'      => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
        'separator' => false
    );


    $this->data['breadcrumbs'][] = array(
        'text'      => $this->language->get('heading_title'),
        'href'      => $this->url->link('module/konfirm', 'token=' . $this->session->data['token'], 'SSL'),
        'separator' => ' :: '
    );

    $this->data['delete'] = $this->url->link('module/konfirm/delete', 'token=' . $this->session->data['token']. $url, 'SSL');               
    $this->data['action'] = $this->url->link('module/konfirm?export=1', 'token=' . $this->session->data['token'], 'SSL');       
    $this->data['cancel'] = $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL');

    $results_total = $this->model_catalog_konfirm->getTotalkonfirm(); 
    $results = $this->model_catalog_konfirm->getkonfirm();
    if(!empty($results))
    {
        foreach($results as $result)
        {
            $this->data['konfirm'][] = array(
                'id'          => $result['id'],
                'name'        => $result['name'],
                'email'       => $result['email'],
                'msg'         => $result['msg'],
                'ip'          => $result['ip'],         
                'telp'        => $result['telp'],
                'orderid'  => $result['orderid'],
                'metodebayar'  => $result['metodebayar'],
                'bank'  => $result['bank'],
                'total'  => $result['total'],
                'tgl'  => $result['tgl'],
                'namapemilik'  => $result['namapemilik'],
                'nomorakun'  => $result['nomorakun'],
                'selected'   => isset($this->request->post['selected']) && in_array($result['id'], $this->request->post['selected']),
                'namaakun'  => $result['namaakun']

            );
        }
    }


    $this->load->model('design/layout');

    $this->data['layouts'] = $this->model_design_layout->getLayouts();

    $this->template = 'module/konfirm.tpl';
    $this->children = array(
        'common/header',
        'common/footer'
    );

    $this->response->setOutput($this->render());
}


}
?>

i only know basic php and can't figure what's wrong here. Thank You very much beforehand.

You are calling validateDelete() here:

 if (isset($this->request->post['selected']) && $this->validateDelete()) {

You didn't define it it anywhere. That causes the error

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM