1: | <?php
2: | namespace Opencart\Admin\Controller\Extension\Opencart\Payment;
3: | /**
4: | * Class Bank Transfer
5: | *
6: | * @package Opencart\Admin\Controller\Extension\Opencart\Payment
7: | */
8: | class BankTransfer extends \Opencart\System\Engine\Controller {
9: | /**
10: | * Index
11: | *
12: | * @return void
13: | */
14: | public function index(): void {
15: | $this->load->language('extension/opencart/payment/bank_transfer');
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=payment')
29: | ];
30: |
31: | $data['breadcrumbs'][] = [
32: | 'text' => $this->language->get('heading_title'),
33: | 'href' => $this->url->link('extension/opencart/payment/bank_transfer', 'user_token=' . $this->session->data['user_token'])
34: | ];
35: |
36: | $data['save'] = $this->url->link('extension/opencart/payment/bank_transfer.save', 'user_token=' . $this->session->data['user_token']);
37: | $data['back'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment');
38: |
39: | $this->load->model('localisation/language');
40: |
41: | $data['payment_bank_transfer_bank'] = [];
42: |
43: | $languages = $this->model_localisation_language->getLanguages();
44: |
45: | foreach ($languages as $language) {
46: | $data['payment_bank_transfer_bank'][$language['language_id']] = $this->config->get('payment_bank_transfer_bank_' . $language['language_id']);
47: | }
48: |
49: | $data['languages'] = $languages;
50: |
51: | $data['payment_bank_transfer_order_status_id'] = $this->config->get('payment_bank_transfer_order_status_id');
52: |
53: | $this->load->model('localisation/order_status');
54: |
55: | $data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
56: |
57: | $data['payment_bank_transfer_geo_zone_id'] = $this->config->get('payment_bank_transfer_geo_zone_id');
58: |
59: | $this->load->model('localisation/geo_zone');
60: |
61: | $data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones();
62: |
63: | $data['payment_bank_transfer_status'] = $this->config->get('payment_bank_transfer_status');
64: | $data['payment_bank_transfer_sort_order'] = $this->config->get('payment_bank_transfer_sort_order');
65: |
66: | $data['header'] = $this->load->controller('common/header');
67: | $data['column_left'] = $this->load->controller('common/column_left');
68: | $data['footer'] = $this->load->controller('common/footer');
69: |
70: | $this->response->setOutput($this->load->view('extension/opencart/payment/bank_transfer', $data));
71: | }
72: |
73: | /**
74: | * Save
75: | *
76: | * @return void
77: | */
78: | public function save(): void {
79: | $this->load->language('extension/opencart/payment/bank_transfer');
80: |
81: | $json = [];
82: |
83: | if (!$this->user->hasPermission('modify', 'extension/opencart/payment/bank_transfer')) {
84: | $json['error']['warning'] = $this->language->get('error_permission');
85: | }
86: |
87: | $this->load->model('localisation/language');
88: |
89: | $languages = $this->model_localisation_language->getLanguages();
90: |
91: | foreach ($languages as $language) {
92: | if (empty($this->request->post['payment_bank_transfer_bank_' . $language['language_id']])) {
93: | $json['error']['bank_' . $language['language_id']] = $this->language->get('error_bank');
94: | }
95: | }
96: |
97: | if (!$json) {
98: | $this->load->model('setting/setting');
99: |
100: | $this->model_setting_setting->editSetting('payment_bank_transfer', $this->request->post);
101: |
102: | $json['success'] = $this->language->get('text_success');
103: | }
104: |
105: | $this->response->addHeader('Content-Type: application/json');
106: | $this->response->setOutput(json_encode($json));
107: | }
108: | }
109: |

OpenCart API API documentation generated by ApiGen dev-master