| 1: | <?php
|
| 2: | namespace Opencart\Admin\Controller\Extension\Opencart\Total;
|
| 3: | |
| 4: | |
| 5: | |
| 6: | |
| 7: |
|
| 8: | class Credit extends \Opencart\System\Engine\Controller {
|
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: |
|
| 14: | public function index(): void {
|
| 15: | $this->load->language('extension/opencart/total/credit');
|
| 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/credit', 'user_token=' . $this->session->data['user_token'])
|
| 34: | ];
|
| 35: |
|
| 36: | $data['save'] = $this->url->link('extension/opencart/total/credit.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_credit_status'] = $this->config->get('total_credit_status');
|
| 40: | $data['total_credit_sort_order'] = $this->config->get('total_credit_sort_order');
|
| 41: |
|
| 42: | $data['header'] = $this->load->controller('common/header');
|
| 43: | $data['column_left'] = $this->load->controller('common/column_left');
|
| 44: | $data['footer'] = $this->load->controller('common/footer');
|
| 45: |
|
| 46: | $this->response->setOutput($this->load->view('extension/opencart/total/credit', $data));
|
| 47: | }
|
| 48: |
|
| 49: | |
| 50: | |
| 51: | |
| 52: | |
| 53: |
|
| 54: | public function save(): void {
|
| 55: | $this->load->language('extension/opencart/total/credit');
|
| 56: |
|
| 57: | $json = [];
|
| 58: |
|
| 59: | if (!$this->user->hasPermission('modify', 'extension/opencart/total/credit')) {
|
| 60: | $json['error'] = $this->language->get('error_permission');
|
| 61: | }
|
| 62: |
|
| 63: | if (!$json) {
|
| 64: | $this->load->model('setting/setting');
|
| 65: |
|
| 66: | $this->model_setting_setting->editSetting('total_credit', $this->request->post);
|
| 67: |
|
| 68: | $json['success'] = $this->language->get('text_success');
|
| 69: | }
|
| 70: |
|
| 71: | $this->response->addHeader('Content-Type: application/json');
|
| 72: | $this->response->setOutput(json_encode($json));
|
| 73: | }
|
| 74: | }
|
| 75: | |