简体   繁体   中英

Opencart add custom page in admin folder getting error Page Not Found

Am creating a custom page called no.tpl in admin folder. It used for No-Order for selected customer.

In view/template/sale/order_list.tpl Am creating a link for No Order page.

<a href="<?php echo $no; ?>" data-toggle="tooltip" title="No Order" class="btn btn-primary"><i class="fa fa-ban"></i> No Order</a>

And i called this link in controller/sale/order.php

$data['no'] = $this->url->link('sale/order/no', 'token=' . $this->session->data['token'], 'SSL');

Then am creating a no.tpl file in view/template/sale/ . That code is following

<?php echo $header; ?><?php echo $column_left; ?>
/*
some content here
*/

And finally and creating a controller this is the path controller/sale/no.php And that page code following

class ControllerSaleNo extends Controller {
    private $error = array();
    public function index() {

           $data=$this->request->post;
           $customerId=$data['customer_id'];

        $this->sendMail($customerId);

        $data['column_left'] = $this->load->controller('common/column_left');
        $data['column_right'] = $this->load->controller('common/column_right');
        $data['content_top'] = $this->load->controller('common/content_top');
        $data['content_bottom'] = $this->load->controller('common/content_bottom');
        $data['footer'] = $this->load->controller('common/footer');
        $data['header'] = $this->load->controller('common/header');

        $this->response->setOutput($this->load->view('default/template/product/no.tpl', $data));

        }
}

But am getting error link

Page Not Found! The page you are looking for could not be found! Please contact your administrator if the problem persists.

How can i clear this error and where i did mistake

Thank You in advance.

Your link wants to access to no function in order controller:

$data['no'] = $this->url->link('sale/order/no', 'token=' . $this->session->data['token'], 'SSL');

change it to:

$data['no'] = $this->url->link('sale/no', 'token=' . $this->session->data['token'], 'SSL');

PS: your controller/sale/no.php has some errors, you must fix Them.

I also encounter a similar problem when accessing the administrative pagination of design, and when checking the code, the problem is as follows:

Direction : OpenCart/admin/controller/design/translation.php
code in line 232

$pagination->url = $this->url->link('design/translation/history', 'user_token=' . $this->session->data['user_token'] . '&page={page}', true);

The path of the web page has been redundant /history in it, so it did not work when it went to page 2

And when I delete it, everything works normally.

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