docs/api/source-extension.opencart.admin.controller.shipping.weight.html
| 1: | <?php | | 2: | namespace Opencart\Admin\Controller\Extension\Opencart\Shipping; | | 3: | /** | | 4: | * Class Weight | | 5: | * | | 6: | * @package Opencart\Admin\Controller\Extension\Opencart\Shipping | | 7: | */ | | 8: | class Weight 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/weight'); | | 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/weight', 'user_token=' . $this->session->data['user_token']) | | 34: | ]; | | 35: | | | 36: | $data['save'] = $this->url->link('extension/opencart/shipping/weight.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: | $this->load->model('localisation/geo_zone'); | | 40: | | | 41: | $geo_zones = $this->model_localisation_geo_zone->getGeoZones(); | | 42: | | | 43: | foreach ($geo_zones as $geo_zone) { | | 44: | $data['shipping_weight_geo_zone_rate'][$geo_zone['geo_zone_id']] = $this->config->get('shipping_weight_' . $geo_zone['geo_zone_id'] . '_rate'); | | 45: | $data['shipping_weight_geo_zone_status'][$geo_zone['geo_zone_id']] = $this->config->get('shipping_weight_' . $geo_zone['geo_zone_id'] . '_status'); | | 46: | } | | 47: | | | 48: | $data['geo_zones'] = $geo_zones; | | 49: | | | 50: | $data['shipping_weight_tax_class_id'] = $this->config->get('shipping_weight_tax_class_id'); | | 51: | | | 52: | $this->load->model('localisation/tax_class'); | | 53: | | | 54: | $data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses(); | | 55: | | | 56: | $data['shipping_weight_status'] = $this->config->get('shipping_weight_status'); | | 57: | $data['shipping_weight_sort_order'] = $this->config->get('shipping_weight_sort_order'); | | 58: | | | 59: | $data['header'] = $this->load->controller('common/header'); | | 60: | $data['column_left'] = $this->load->controller('common/column_left'); | | 61: | $data['footer'] = $this->load->controller('common/footer'); | | 62: | | | 63: | $this->response->setOutput($this->load->view('extension/opencart/shipping/weight', $data)); | | 64: | } | | 65: | | | 66: | /** | | 67: | * Save | | 68: | * | | 69: | * @return void | | 70: | */ | | 71: | public function save(): void { | | 72: | $this->load->language('extension/opencart/shipping/weight'); | | 73: | | | 74: | $json = []; | | 75: | | | 76: | if (!$this->user->hasPermission('modify', 'extension/opencart/shipping/weight')) { | | 77: | $json['error'] = $this->language->get('error_permission'); | | 78: | } | | 79: | | | 80: | if (!$json) { | | 81: | $this->load->model('setting/setting'); | | 82: | | | 83: | $this->model_setting_setting->editSetting('shipping_weight', $this->request->post); | | 84: | | | 85: | $json['success'] = $this->language->get('text_success'); | | 86: | } | | 87: | | | 88: | $this->response->addHeader('Content-Type: application/json'); | | 89: | $this->response->setOutput(json_encode($json)); | | 90: | } | | 91: | } | | 92: | |
OpenCart API API documentation generated by ApiGen dev-master