1: | <?php
2: | namespace Opencart\Admin\Controller\Extension\Opencart\Shipping;
3: | /**
4: | * Class Item
5: | *
6: | * @package Opencart\Admin\Controller\Extension\Opencart\Shipping
7: | */
8: | class Item extends \Opencart\System\Engine\Controller {
9: | /**
10: | * Index
11: | *
12: | * @return void
13: | */
14: | public function index(): void {
15: | $this->load->language('extension/opencart/shipping/item');
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=shipping')
29: | ];
30: |
31: | $data['breadcrumbs'][] = [
32: | 'text' => $this->language->get('heading_title'),
33: | 'href' => $this->url->link('extension/opencart/shipping/item', 'user_token=' . $this->session->data['user_token'])
34: | ];
35: |
36: | $data['save'] = $this->url->link('extension/opencart/shipping/item.save', 'user_token=' . $this->session->data['user_token']);
37: | $data['back'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping');
38: |
39: | $data['shipping_item_cost'] = $this->config->get('shipping_item_cost');
40: | $data['shipping_item_tax_class_id'] = $this->config->get('shipping_item_tax_class_id');
41: |
42: | $this->load->model('localisation/tax_class');
43: |
44: | $data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses();
45: | $data['shipping_item_geo_zone_id'] = $this->config->get('shipping_item_geo_zone_id');
46: |
47: | $this->load->model('localisation/geo_zone');
48: |
49: | $data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones();
50: |
51: | $data['shipping_item_status'] = $this->config->get('shipping_item_status');
52: | $data['shipping_item_sort_order'] = $this->config->get('shipping_item_sort_order');
53: |
54: | $data['header'] = $this->load->controller('common/header');
55: | $data['column_left'] = $this->load->controller('common/column_left');
56: | $data['footer'] = $this->load->controller('common/footer');
57: |
58: | $this->response->setOutput($this->load->view('extension/opencart/shipping/item', $data));
59: | }
60: |
61: | /**
62: | * Save
63: | *
64: | * @return void
65: | */
66: | public function save(): void {
67: | $this->load->language('extension/opencart/shipping/item');
68: |
69: | $json = [];
70: |
71: | if (!$this->user->hasPermission('modify', 'extension/opencart/shipping/item')) {
72: | $json['error'] = $this->language->get('error_permission');
73: | }
74: |
75: | if (!$json) {
76: | $this->load->model('setting/setting');
77: |
78: | $this->model_setting_setting->editSetting('shipping_item', $this->request->post);
79: |
80: | $json['success'] = $this->language->get('text_success');
81: | }
82: |
83: | $this->response->addHeader('Content-Type: application/json');
84: | $this->response->setOutput(json_encode($json));
85: | }
86: | }
87: |

OpenCart API API documentation generated by ApiGen dev-master