1: | <?php
|
2: | namespace Opencart\Admin\Controller\Extension\Opencart\Total;
|
3: | |
4: | |
5: | |
6: | |
7: |
|
8: | class Handling extends \Opencart\System\Engine\Controller {
|
9: | |
10: | |
11: | |
12: | |
13: |
|
14: | public function index(): void {
|
15: | $this->load->language('extension/opencart/total/handling');
|
16: |
|
17: | $this->document->setTitle($this->language->get('heading_title'));
|
18: |
|
19: | $data['breadcrumbs'] = [];
|
20: |
|
21: | $data['breadcrumbs'][] = [
|
22: | 'text' => $this->language->get('text_home'),
|
23: | 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'])
|
24: | ];
|
25: |
|
26: | $data['breadcrumbs'][] = [
|
27: | 'text' => $this->language->get('text_extension'),
|
28: | 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total')
|
29: | ];
|
30: |
|
31: | $data['breadcrumbs'][] = [
|
32: | 'text' => $this->language->get('heading_title'),
|
33: | 'href' => $this->url->link('extension/opencart/total/handling', 'user_token=' . $this->session->data['user_token'])
|
34: | ];
|
35: |
|
36: | $data['save'] = $this->url->link('extension/opencart/total/handling.save', 'user_token=' . $this->session->data['user_token']);
|
37: | $data['back'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total');
|
38: |
|
39: | $data['total_handling_total'] = $this->config->get('total_handling_total');
|
40: | $data['total_handling_fee'] = $this->config->get('total_handling_fee');
|
41: | $data['total_handling_tax_class_id'] = $this->config->get('total_handling_tax_class_id');
|
42: |
|
43: | $this->load->model('localisation/tax_class');
|
44: |
|
45: | $data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses();
|
46: |
|
47: | $data['total_handling_status'] = $this->config->get('total_handling_status');
|
48: | $data['total_handling_sort_order'] = $this->config->get('total_handling_sort_order');
|
49: |
|
50: | $data['header'] = $this->load->controller('common/header');
|
51: | $data['column_left'] = $this->load->controller('common/column_left');
|
52: | $data['footer'] = $this->load->controller('common/footer');
|
53: |
|
54: | $this->response->setOutput($this->load->view('extension/opencart/total/handling', $data));
|
55: | }
|
56: |
|
57: | |
58: | |
59: | |
60: | |
61: |
|
62: | public function save(): void {
|
63: | $this->load->language('extension/opencart/total/handling');
|
64: |
|
65: | $json = [];
|
66: |
|
67: | if (!$this->user->hasPermission('modify', 'extension/opencart/total/handling')) {
|
68: | $json['error'] = $this->language->get('error_permission');
|
69: | }
|
70: |
|
71: | if (!$json) {
|
72: | $this->load->model('setting/setting');
|
73: |
|
74: | $this->model_setting_setting->editSetting('total_handling', $this->request->post);
|
75: |
|
76: | $json['success'] = $this->language->get('text_success');
|
77: | }
|
78: |
|
79: | $this->response->addHeader('Content-Type: application/json');
|
80: | $this->response->setOutput(json_encode($json));
|
81: | }
|
82: | }
|
83: | |