diff options
Diffstat (limited to 'public/admin/controller/extension/shipping')
-rw-r--r-- | public/admin/controller/extension/shipping/auspost.php | 135 | ||||
-rw-r--r-- | public/admin/controller/extension/shipping/ec_ship.php | 229 | ||||
-rw-r--r-- | public/admin/controller/extension/shipping/fedex.php | 378 | ||||
-rw-r--r-- | public/admin/controller/extension/shipping/flat.php | 99 | ||||
-rw-r--r-- | public/admin/controller/extension/shipping/free.php | 89 | ||||
-rw-r--r-- | public/admin/controller/extension/shipping/item.php | 99 | ||||
-rw-r--r-- | public/admin/controller/extension/shipping/parcelforce_48.php | 127 | ||||
-rw-r--r-- | public/admin/controller/extension/shipping/pickup.php | 83 | ||||
-rw-r--r-- | public/admin/controller/extension/shipping/royal_mail.php | 403 | ||||
-rw-r--r-- | public/admin/controller/extension/shipping/ups.php | 744 | ||||
-rw-r--r-- | public/admin/controller/extension/shipping/usps.php | 464 | ||||
-rw-r--r-- | public/admin/controller/extension/shipping/weight.php | 103 |
12 files changed, 2953 insertions, 0 deletions
diff --git a/public/admin/controller/extension/shipping/auspost.php b/public/admin/controller/extension/shipping/auspost.php new file mode 100644 index 0000000..8f4f036 --- /dev/null +++ b/public/admin/controller/extension/shipping/auspost.php @@ -0,0 +1,135 @@ +<?php +class ControllerExtensionShippingAusPost extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/shipping/auspost'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/setting'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('shipping_auspost', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + if (isset($this->error['api'])) { + $data['error_api'] = $this->error['api']; + } else { + $data['error_api'] = ''; + } + + if (isset($this->error['postcode'])) { + $data['error_postcode'] = $this->error['postcode']; + } else { + $data['error_postcode'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/shipping/auspost', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/shipping/auspost', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true); + + if (isset($this->request->post['shipping_auspost_postcode'])) { + $data['shipping_auspost_postcode'] = $this->request->post['shipping_auspost_postcode']; + } else { + $data['shipping_auspost_postcode'] = $this->config->get('shipping_auspost_postcode'); + } + + if (isset($this->request->post['shipping_auspost_api'])) { + $data['shipping_auspost_api'] = $this->request->post['shipping_auspost_api']; + } else { + $data['shipping_auspost_api'] = $this->config->get('shipping_auspost_api'); + } + + if (isset($this->request->post['shipping_auspost_weight_class_id'])) { + $data['shipping_auspost_weight_class_id'] = $this->request->post['shipping_auspost_weight_class_id']; + } else { + $data['shipping_auspost_weight_class_id'] = $this->config->get('shipping_auspost_weight_class_id'); + } + + $this->load->model('localisation/weight_class'); + + $data['weight_classes'] = $this->model_localisation_weight_class->getWeightClasses(); + + if (isset($this->request->post['shipping_auspost_tax_class_id'])) { + $data['shipping_auspost_tax_class_id'] = $this->request->post['shipping_auspost_tax_class_id']; + } else { + $data['shipping_auspost_tax_class_id'] = $this->config->get('shipping_auspost_tax_class_id'); + } + + $this->load->model('localisation/tax_class'); + + $data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses(); + + if (isset($this->request->post['shipping_auspost_geo_zone_id'])) { + $data['shipping_auspost_geo_zone_id'] = $this->request->post['shipping_auspost_geo_zone_id']; + } else { + $data['shipping_auspost_geo_zone_id'] = $this->config->get('shipping_auspost_geo_zone_id'); + } + + $this->load->model('localisation/geo_zone'); + + $data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones(); + + if (isset($this->request->post['shipping_auspost_status'])) { + $data['shipping_auspost_status'] = $this->request->post['shipping_auspost_status']; + } else { + $data['shipping_auspost_status'] = $this->config->get('shipping_auspost_status'); + } + + if (isset($this->request->post['shipping_auspost_sort_order'])) { + $data['shipping_auspost_sort_order'] = $this->request->post['shipping_auspost_sort_order']; + } else { + $data['shipping_auspost_sort_order'] = $this->config->get('shipping_auspost_sort_order'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/shipping/auspost', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/shipping/auspost')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + if (empty($this->request->post['shipping_auspost_api'])) { + $this->error['api'] = $this->language->get('error_api'); + } + + if (!preg_match('/^[0-9]{4}$/', $this->request->post['shipping_auspost_postcode'])) { + $this->error['postcode'] = $this->language->get('error_postcode'); + } + + return !$this->error; + } +}
\ No newline at end of file diff --git a/public/admin/controller/extension/shipping/ec_ship.php b/public/admin/controller/extension/shipping/ec_ship.php new file mode 100644 index 0000000..b743c6c --- /dev/null +++ b/public/admin/controller/extension/shipping/ec_ship.php @@ -0,0 +1,229 @@ +<?php +class ControllerExtensionShippingECShip extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/shipping/ec_ship'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/setting'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('shipping_ec_ship', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + if (isset($this->error['username'])) { + $data['error_username'] = $this->error['username']; + } else { + $data['error_username'] = ''; + } + + if (isset($this->error['api_username'])) { + $data['error_api_username'] = $this->error['entry_api_username']; + } else { + $data['error_api_username'] = ''; + } + + if (isset($this->error['api_key'])) { + $data['error_api_key'] = $this->error['api_key']; + } else { + $data['error_api_key'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/shipping/ec_ship', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/shipping/ec_ship', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true); + + if (isset($this->request->post['shipping_ec_ship_api_key'])) { + $data['shipping_ec_ship_api_key'] = $this->request->post['shipping_ec_ship_api_key']; + } else { + $data['shipping_ec_ship_api_key'] = $this->config->get('shipping_ec_ship_api_key'); + } + + if (isset($this->request->post['shipping_ec_ship_username'])) { + $data['shipping_ec_ship_username'] = $this->request->post['shipping_ec_ship_username']; + } else { + $data['shipping_ec_ship_username'] = $this->config->get('shipping_ec_ship_username'); + } + + if (isset($this->request->post['shipping_ec_ship_api_username'])) { + $data['shipping_ec_ship_api_username'] = $this->request->post['shipping_ec_ship_api_username']; + } else { + $data['shipping_ec_ship_api_username'] = $this->config->get('shipping_ec_ship_api_username'); + } + + if (isset($this->request->post['shipping_ec_ship_test'])) { + $data['shipping_ec_ship_test'] = $this->request->post['shipping_ec_ship_test']; + } else { + $data['shipping_ec_ship_test'] = $this->config->get('shipping_ec_ship_test'); + } + + if (isset($this->request->post['shipping_ec_ship_air_registered_mail'])) { + $data['shipping_ec_ship_air_registered_mail'] = $this->request->post['shipping_ec_ship_air_registered_mail']; + } else { + $data['shipping_ec_ship_air_registered_mail'] = $this->config->get('shipping_ec_ship_air_registered_mail'); + } + + if (isset($this->request->post['shipping_ec_ship_air_parcel'])) { + $data['shipping_ec_ship_air_parcel'] = $this->request->post['shipping_ec_ship_air_parcel']; + } else { + $data['shipping_ec_ship_air_parcel'] = $this->config->get('shipping_ec_ship_air_parcel'); + } + + if (isset($this->request->post['shipping_ec_ship_e_express_service_to_us'])) { + $data['shipping_ec_ship_e_express_service_to_us'] = $this->request->post['shipping_ec_ship_e_express_service_to_us']; + } else { + $data['shipping_ec_ship_e_express_service_to_us'] = $this->config->get('shipping_ec_ship_e_express_service_to_us'); + } + + if (isset($this->request->post['shipping_ec_ship_e_express_service_to_canada'])) { + $data['shipping_ec_ship_e_express_service_to_canada'] = $this->request->post['shipping_ec_ship_e_express_service_to_canada']; + } else { + $data['shipping_ec_ship_e_express_service_to_canada'] = $this->config->get('shipping_ec_ship_e_express_service_to_canada'); + } + + if (isset($this->request->post['shipping_ec_ship_e_express_service_to_united_kingdom'])) { + $data['shipping_ec_ship_e_express_service_to_united_kingdom'] = $this->request->post['shipping_ec_ship_e_express_service_to_united_kingdom']; + } else { + $data['shipping_ec_ship_e_express_service_to_united_kingdom'] = $this->config->get('shipping_ec_ship_e_express_service_to_united_kingdom'); + } + + if (isset($this->request->post['shipping_ec_ship_e_express_service_to_russia'])) { + $data['shipping_ec_ship_e_express_service_to_russia'] = $this->request->post['shipping_ec_ship_e_express_service_to_russia']; + } else { + $data['shipping_ec_ship_e_express_service_to_russia'] = $this->config->get('shipping_ec_ship_e_express_service_to_russia'); + } + + if (isset($this->request->post['shipping_ec_ship_e_express_service_one'])) { + $data['shipping_ec_ship_e_express_service_one'] = $this->request->post['shipping_ec_ship_e_express_service_one']; + } else { + $data['shipping_ec_ship_e_express_service_one'] = $this->config->get('shipping_ec_ship_e_express_service_one'); + } + + if (isset($this->request->post['shipping_ec_ship_e_express_service_two'])) { + $data['shipping_ec_ship_e_express_service_two'] = $this->request->post['shipping_ec_ship_e_express_service_two']; + } else { + $data['shipping_ec_ship_e_express_service_two'] = $this->config->get('shipping_ec_ship_e_express_service_two'); + } + + if (isset($this->request->post['shipping_ec_ship_speed_post'])) { + $data['shipping_ec_ship_speed_post'] = $this->request->post['shipping_ec_ship_speed_post']; + } else { + $data['shipping_ec_ship_speed_post'] = $this->config->get('shipping_ec_ship_speed_post'); + } + + if (isset($this->request->post['shipping_ec_ship_smart_post'])) { + $data['shipping_ec_ship_smart_post'] = $this->request->post['shipping_ec_ship_smart_post']; + } else { + $data['shipping_ec_ship_smart_post'] = $this->config->get('shipping_ec_ship_smart_post'); + } + + if (isset($this->request->post['shipping_ec_ship_local_courier_post'])) { + $data['shipping_ec_ship_local_courier_post'] = $this->request->post['shipping_ec_ship_local_courier_post']; + } else { + $data['shipping_ec_ship_local_courier_post'] = $this->config->get('shipping_ec_ship_local_courier_post'); + } + + if (isset($this->request->post['shipping_ec_ship_local_parcel'])) { + $data['shipping_ec_ship_local_parcel'] = $this->request->post['shipping_ec_ship_local_parcel']; + } else { + $data['shipping_ec_ship_local_parcel'] = $this->config->get('shipping_ec_ship_local_parcel'); + } + + if (isset($this->request->post['shipping_ec_ship_weight_class_id'])) { + $data['shipping_ec_ship_weight_class_id'] = $this->request->post['shipping_ec_ship_weight_class_id']; + } else { + $data['shipping_ec_ship_weight_class_id'] = $this->config->get('shipping_ec_ship_weight_class_id'); + } + + $this->load->model('localisation/weight_class'); + + $data['weight_classes'] = $this->model_localisation_weight_class->getWeightClasses(); + + if (isset($this->request->post['shipping_ec_ship_tax_class_id'])) { + $data['shipping_ec_ship_tax_class_id'] = $this->request->post['shipping_ec_ship_tax_class_id']; + } else { + $data['shipping_ec_ship_tax_class_id'] = $this->config->get('shipping_ec_ship_tax_class_id'); + } + + $this->load->model('localisation/tax_class'); + + $data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses(); + + if (isset($this->request->post['shipping_ec_ship_geo_zone_id'])) { + $data['shipping_ec_ship_geo_zone_id'] = $this->request->post['shipping_ec_ship_geo_zone_id']; + } else { + $data['shipping_ec_ship_geo_zone_id'] = $this->config->get('shipping_ec_ship_geo_zone_id'); + } + + $this->load->model('localisation/geo_zone'); + + $data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones(); + + if (isset($this->request->post['shipping_ec_ship_status'])) { + $data['shipping_ec_ship_status'] = $this->request->post['shipping_ec_ship_status']; + } else { + $data['shipping_ec_ship_status'] = $this->config->get('shipping_ec_ship_status'); + } + + if (isset($this->request->post['shipping_ec_ship_sort_order'])) { + $data['shipping_ec_ship_sort_order'] = $this->request->post['shipping_ec_ship_sort_order']; + } else { + $data['shipping_ec_ship_sort_order'] = $this->config->get('shipping_ec_ship_sort_order'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/shipping/ec_ship', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/shipping/ec_ship')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + if (!$this->request->post['shipping_ec_ship_api_key']) { + $this->error['api_key'] = $this->language->get('error_api_key'); + } + + if (!$this->request->post['shipping_ec_ship_username']) { + $this->error['username'] = $this->language->get('error_username'); + } + + if (!$this->request->post['shipping_ec_ship_api_username']) { + $this->error['api_username'] = $this->language->get('error_api_username'); + } + + return !$this->error; + } +} diff --git a/public/admin/controller/extension/shipping/fedex.php b/public/admin/controller/extension/shipping/fedex.php new file mode 100644 index 0000000..37a3f8e --- /dev/null +++ b/public/admin/controller/extension/shipping/fedex.php @@ -0,0 +1,378 @@ +<?php +class ControllerExtensionShippingFedex extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/shipping/fedex'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/setting'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('shipping_fedex', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + if (isset($this->error['key'])) { + $data['error_key'] = $this->error['key']; + } else { + $data['error_key'] = ''; + } + + if (isset($this->error['password'])) { + $data['error_password'] = $this->error['password']; + } else { + $data['error_password'] = ''; + } + + if (isset($this->error['account'])) { + $data['error_account'] = $this->error['account']; + } else { + $data['error_account'] = ''; + } + + if (isset($this->error['meter'])) { + $data['error_meter'] = $this->error['meter']; + } else { + $data['error_meter'] = ''; + } + + if (isset($this->error['postcode'])) { + $data['error_postcode'] = $this->error['postcode']; + } else { + $data['error_postcode'] = ''; + } + + if (isset($this->error['dimension'])) { + $data['error_dimension'] = $this->error['dimension']; + } else { + $data['error_dimension'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/shipping/fedex', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/shipping/fedex', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true); + + if (isset($this->request->post['shipping_fedex_key'])) { + $data['shipping_fedex_key'] = $this->request->post['shipping_fedex_key']; + } else { + $data['shipping_fedex_key'] = $this->config->get('shipping_fedex_key'); + } + + if (isset($this->request->post['shipping_fedex_password'])) { + $data['shipping_fedex_password'] = $this->request->post['shipping_fedex_password']; + } else { + $data['shipping_fedex_password'] = $this->config->get('shipping_fedex_password'); + } + + if (isset($this->request->post['shipping_fedex_account'])) { + $data['shipping_fedex_account'] = $this->request->post['shipping_fedex_account']; + } else { + $data['shipping_fedex_account'] = $this->config->get('shipping_fedex_account'); + } + + if (isset($this->request->post['shipping_fedex_meter'])) { + $data['shipping_fedex_meter'] = $this->request->post['shipping_fedex_meter']; + } else { + $data['shipping_fedex_meter'] = $this->config->get('shipping_fedex_meter'); + } + + if (isset($this->request->post['shipping_fedex_postcode'])) { + $data['shipping_fedex_postcode'] = $this->request->post['shipping_fedex_postcode']; + } else { + $data['shipping_fedex_postcode'] = $this->config->get('shipping_fedex_postcode'); + } + + if (isset($this->request->post['shipping_fedex_test'])) { + $data['shipping_fedex_test'] = $this->request->post['shipping_fedex_test']; + } else { + $data['shipping_fedex_test'] = $this->config->get('shipping_fedex_test'); + } + + if (isset($this->request->post['shipping_fedex_service'])) { + $data['shipping_fedex_service'] = $this->request->post['shipping_fedex_service']; + } elseif ($this->config->has('shipping_fedex_service')) { + $data['shipping_fedex_service'] = $this->config->get('shipping_fedex_service'); + } else { + $data['shipping_fedex_service'] = array(); + } + + $data['services'] = array(); + + $data['services'][] = array( + 'text' => $this->language->get('text_europe_first_international_priority'), + 'value' => 'EUROPE_FIRST_INTERNATIONAL_PRIORITY' + ); + + $data['services'][] = array( + 'text' => $this->language->get('text_fedex_1_day_freight'), + 'value' => 'FEDEX_1_DAY_FREIGHT' + ); + + $data['services'][] = array( + 'text' => $this->language->get('text_fedex_2_day'), + 'value' => 'FEDEX_2_DAY' + ); + + $data['services'][] = array( + 'text' => $this->language->get('text_fedex_2_day_am'), + 'value' => 'FEDEX_2_DAY_AM' + ); + + $data['services'][] = array( + 'text' => $this->language->get('text_fedex_2_day_freight'), + 'value' => 'FEDEX_2_DAY_FREIGHT' + ); + + $data['services'][] = array( + 'text' => $this->language->get('text_fedex_3_day_freight'), + 'value' => 'FEDEX_3_DAY_FREIGHT' + ); + + $data['services'][] = array( + 'text' => $this->language->get('text_fedex_express_saver'), + 'value' => 'FEDEX_EXPRESS_SAVER' + ); + + $data['services'][] = array( + 'text' => $this->language->get('text_fedex_first_freight'), + 'value' => 'FEDEX_FIRST_FREIGHT' + ); + + $data['services'][] = array( + 'text' => $this->language->get('text_fedex_freight_economy'), + 'value' => 'FEDEX_FREIGHT_ECONOMY' + ); + + $data['services'][] = array( + 'text' => $this->language->get('text_fedex_freight_priority'), + 'value' => 'FEDEX_FREIGHT_PRIORITY' + ); + + $data['services'][] = array( + 'text' => $this->language->get('text_fedex_ground'), + 'value' => 'FEDEX_GROUND' + ); + + $data['services'][] = array( + 'text' => $this->language->get('text_first_overnight'), + 'value' => 'FIRST_OVERNIGHT' + ); + + $data['services'][] = array( + 'text' => $this->language->get('text_ground_home_delivery'), + 'value' => 'GROUND_HOME_DELIVERY' + ); + + $data['services'][] = array( + 'text' => $this->language->get('text_international_economy'), + 'value' => 'INTERNATIONAL_ECONOMY' + ); + + $data['services'][] = array( + 'text' => $this->language->get('text_international_economy_freight'), + 'value' => 'INTERNATIONAL_ECONOMY_FREIGHT' + ); + + $data['services'][] = array( + 'text' => $this->language->get('text_international_first'), + 'value' => 'INTERNATIONAL_FIRST' + ); + + $data['services'][] = array( + 'text' => $this->language->get('text_international_priority'), + 'value' => 'INTERNATIONAL_PRIORITY' + ); + + $data['services'][] = array( + 'text' => $this->language->get('text_international_priority_freight'), + 'value' => 'INTERNATIONAL_PRIORITY_FREIGHT' + ); + + $data['services'][] = array( + 'text' => $this->language->get('text_priority_overnight'), + 'value' => 'PRIORITY_OVERNIGHT' + ); + + $data['services'][] = array( + 'text' => $this->language->get('text_smart_post'), + 'value' => 'SMART_POST' + ); + + $data['services'][] = array( + 'text' => $this->language->get('text_standard_overnight'), + 'value' => 'STANDARD_OVERNIGHT' + ); + + if (isset($this->request->post['shipping_fedex_length'])) { + $data['shipping_fedex_length'] = $this->request->post['shipping_fedex_length']; + } else { + $data['shipping_fedex_length'] = $this->config->get('shipping_fedex_length'); + } + + if (isset($this->request->post['shipping_fedex_width'])) { + $data['shipping_fedex_width'] = $this->request->post['shipping_fedex_width']; + } else { + $data['shipping_fedex_width'] = $this->config->get('shipping_fedex_width'); + } + + if (isset($this->request->post['shipping_fedex_height'])) { + $data['shipping_fedex_height'] = $this->request->post['shipping_fedex_height']; + } else { + $data['shipping_fedex_height'] = $this->config->get('shipping_fedex_height'); + } + + if (isset($this->request->post['shipping_fedex_length_class_id'])) { + $data['shipping_fedex_length_class_id'] = $this->request->post['shipping_fedex_length_class_id']; + } else { + $data['shipping_fedex_length_class_id'] = $this->config->get('shipping_fedex_length_class_id'); + } + + $this->load->model('localisation/length_class'); + + $data['length_classes'] = $this->model_localisation_length_class->getLengthClasses(); + + if (isset($this->request->post['shipping_fedex_dropoff_type'])) { + $data['shipping_fedex_dropoff_type'] = $this->request->post['shipping_fedex_dropoff_type']; + } else { + $data['shipping_fedex_dropoff_type'] = $this->config->get('shipping_fedex_dropoff_type'); + } + + if (isset($this->request->post['shipping_fedex_packaging_type'])) { + $data['shipping_fedex_packaging_type'] = $this->request->post['shipping_fedex_packaging_type']; + } else { + $data['shipping_fedex_packaging_type'] = $this->config->get('shipping_fedex_packaging_type'); + } + + if (isset($this->request->post['shipping_fedex_rate_type'])) { + $data['shipping_fedex_rate_type'] = $this->request->post['shipping_fedex_rate_type']; + } else { + $data['shipping_fedex_rate_type'] = $this->config->get('shipping_fedex_rate_type'); + } + + if (isset($this->request->post['shipping_fedex_destination_type'])) { + $data['shipping_fedex_destination_type'] = $this->request->post['shipping_fedex_destination_type']; + } else { + $data['shipping_fedex_destination_type'] = $this->config->get('shipping_fedex_destination_type'); + } + + if (isset($this->request->post['shipping_fedex_display_time'])) { + $data['shipping_fedex_display_time'] = $this->request->post['shipping_fedex_display_time']; + } else { + $data['shipping_fedex_display_time'] = $this->config->get('shipping_fedex_display_time'); + } + + if (isset($this->request->post['shipping_fedex_display_weight'])) { + $data['shipping_fedex_display_weight'] = $this->request->post['shipping_fedex_display_weight']; + } else { + $data['shipping_fedex_display_weight'] = $this->config->get('shipping_fedex_display_weight'); + } + + if (isset($this->request->post['shipping_fedex_weight_class_id'])) { + $data['shipping_fedex_weight_class_id'] = $this->request->post['shipping_fedex_weight_class_id']; + } else { + $data['shipping_fedex_weight_class_id'] = $this->config->get('shipping_fedex_weight_class_id'); + } + + $this->load->model('localisation/weight_class'); + + $data['weight_classes'] = $this->model_localisation_weight_class->getWeightClasses(); + + if (isset($this->request->post['shipping_fedex_tax_class_id'])) { + $data['shipping_fedex_tax_class_id'] = $this->request->post['shipping_fedex_tax_class_id']; + } else { + $data['shipping_fedex_tax_class_id'] = $this->config->get('shipping_fedex_tax_class_id'); + } + + $this->load->model('localisation/tax_class'); + + $data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses(); + + if (isset($this->request->post['shipping_fedex_geo_zone_id'])) { + $data['shipping_fedex_geo_zone_id'] = $this->request->post['shipping_fedex_geo_zone_id']; + } else { + $data['shipping_fedex_geo_zone_id'] = $this->config->get('shipping_fedex_geo_zone_id'); + } + + $this->load->model('localisation/geo_zone'); + + $data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones(); + + if (isset($this->request->post['shipping_fedex_status'])) { + $data['shipping_fedex_status'] = $this->request->post['shipping_fedex_status']; + } else { + $data['shipping_fedex_status'] = $this->config->get('shipping_fedex_status'); + } + + if (isset($this->request->post['shipping_fedex_sort_order'])) { + $data['shipping_fedex_sort_order'] = $this->request->post['shipping_fedex_sort_order']; + } else { + $data['shipping_fedex_sort_order'] = $this->config->get('shipping_fedex_sort_order'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/shipping/fedex', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/shipping/fedex')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + if (!$this->request->post['shipping_fedex_key']) { + $this->error['key'] = $this->language->get('error_key'); + } + + if (!$this->request->post['shipping_fedex_password']) { + $this->error['password'] = $this->language->get('error_password'); + } + + if (!$this->request->post['shipping_fedex_account']) { + $this->error['account'] = $this->language->get('error_account'); + } + + if (!$this->request->post['shipping_fedex_meter']) { + $this->error['meter'] = $this->language->get('error_meter'); + } + + if (!$this->request->post['shipping_fedex_postcode']) { + $this->error['postcode'] = $this->language->get('error_postcode'); + } + + if (!$this->request->post['shipping_fedex_length'] || !$this->request->post['shipping_fedex_width'] || !$this->request->post['shipping_fedex_height']) { + $this->error['dimension'] = $this->language->get('error_dimension'); + } + + return !$this->error; + } +} diff --git a/public/admin/controller/extension/shipping/flat.php b/public/admin/controller/extension/shipping/flat.php new file mode 100644 index 0000000..1d4e161 --- /dev/null +++ b/public/admin/controller/extension/shipping/flat.php @@ -0,0 +1,99 @@ +<?php +class ControllerExtensionShippingFlat extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/shipping/flat'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/setting'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('shipping_flat', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/shipping/flat', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/shipping/flat', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true); + + if (isset($this->request->post['shipping_flat_cost'])) { + $data['shipping_flat_cost'] = $this->request->post['shipping_flat_cost']; + } else { + $data['shipping_flat_cost'] = $this->config->get('shipping_flat_cost'); + } + + if (isset($this->request->post['shipping_flat_tax_class_id'])) { + $data['shipping_flat_tax_class_id'] = $this->request->post['shipping_flat_tax_class_id']; + } else { + $data['shipping_flat_tax_class_id'] = $this->config->get('shipping_flat_tax_class_id'); + } + + $this->load->model('localisation/tax_class'); + + $data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses(); + + if (isset($this->request->post['shipping_flat_geo_zone_id'])) { + $data['shipping_flat_geo_zone_id'] = $this->request->post['shipping_flat_geo_zone_id']; + } else { + $data['shipping_flat_geo_zone_id'] = $this->config->get('shipping_flat_geo_zone_id'); + } + + $this->load->model('localisation/geo_zone'); + + $data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones(); + + if (isset($this->request->post['shipping_flat_status'])) { + $data['shipping_flat_status'] = $this->request->post['shipping_flat_status']; + } else { + $data['shipping_flat_status'] = $this->config->get('shipping_flat_status'); + } + + if (isset($this->request->post['shipping_flat_sort_order'])) { + $data['shipping_flat_sort_order'] = $this->request->post['shipping_flat_sort_order']; + } else { + $data['shipping_flat_sort_order'] = $this->config->get('shipping_flat_sort_order'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/shipping/flat', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/shipping/flat')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + return !$this->error; + } +}
\ No newline at end of file diff --git a/public/admin/controller/extension/shipping/free.php b/public/admin/controller/extension/shipping/free.php new file mode 100644 index 0000000..c7828a6 --- /dev/null +++ b/public/admin/controller/extension/shipping/free.php @@ -0,0 +1,89 @@ +<?php +class ControllerExtensionShippingFree extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/shipping/free'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/setting'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('shipping_free', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/shipping/free', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/shipping/free', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true); + + if (isset($this->request->post['shipping_free_total'])) { + $data['shipping_free_total'] = $this->request->post['shipping_free_total']; + } else { + $data['shipping_free_total'] = $this->config->get('shipping_free_total'); + } + + if (isset($this->request->post['shipping_free_geo_zone_id'])) { + $data['shipping_free_geo_zone_id'] = $this->request->post['shipping_free_geo_zone_id']; + } else { + $data['shipping_free_geo_zone_id'] = $this->config->get('shipping_free_geo_zone_id'); + } + + $this->load->model('localisation/geo_zone'); + + $data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones(); + + if (isset($this->request->post['shipping_free_status'])) { + $data['shipping_free_status'] = $this->request->post['shipping_free_status']; + } else { + $data['shipping_free_status'] = $this->config->get('shipping_free_status'); + } + + if (isset($this->request->post['shipping_free_sort_order'])) { + $data['shipping_free_sort_order'] = $this->request->post['shipping_free_sort_order']; + } else { + $data['shipping_free_sort_order'] = $this->config->get('shipping_free_sort_order'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/shipping/free', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/shipping/free')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + return !$this->error; + } +}
\ No newline at end of file diff --git a/public/admin/controller/extension/shipping/item.php b/public/admin/controller/extension/shipping/item.php new file mode 100644 index 0000000..0e4bfc7 --- /dev/null +++ b/public/admin/controller/extension/shipping/item.php @@ -0,0 +1,99 @@ +<?php +class ControllerExtensionShippingItem extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/shipping/item'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/setting'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('shipping_item', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/shipping/item', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/shipping/item', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true); + + if (isset($this->request->post['shipping_item_cost'])) { + $data['shipping_item_cost'] = $this->request->post['shipping_item_cost']; + } else { + $data['shipping_item_cost'] = $this->config->get('shipping_item_cost'); + } + + if (isset($this->request->post['shipping_item_tax_class_id'])) { + $data['shipping_item_tax_class_id'] = $this->request->post['shipping_item_tax_class_id']; + } else { + $data['shipping_item_tax_class_id'] = $this->config->get('shipping_item_tax_class_id'); + } + + $this->load->model('localisation/tax_class'); + + $data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses(); + + if (isset($this->request->post['shipping_item_geo_zone_id'])) { + $data['shipping_item_geo_zone_id'] = $this->request->post['shipping_item_geo_zone_id']; + } else { + $data['shipping_item_geo_zone_id'] = $this->config->get('shipping_item_geo_zone_id'); + } + + $this->load->model('localisation/geo_zone'); + + $data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones(); + + if (isset($this->request->post['shipping_item_status'])) { + $data['shipping_item_status'] = $this->request->post['shipping_item_status']; + } else { + $data['shipping_item_status'] = $this->config->get('shipping_item_status'); + } + + if (isset($this->request->post['shipping_item_sort_order'])) { + $data['shipping_item_sort_order'] = $this->request->post['shipping_item_sort_order']; + } else { + $data['shipping_item_sort_order'] = $this->config->get('shipping_item_sort_order'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/shipping/item', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/shipping/item')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + return !$this->error; + } +}
\ No newline at end of file diff --git a/public/admin/controller/extension/shipping/parcelforce_48.php b/public/admin/controller/extension/shipping/parcelforce_48.php new file mode 100644 index 0000000..6e6d49e --- /dev/null +++ b/public/admin/controller/extension/shipping/parcelforce_48.php @@ -0,0 +1,127 @@ +<?php +class ControllerExtensionShippingParcelforce48 extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/shipping/parcelforce_48'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/setting'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('shipping_parcelforce_48', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/shipping/parcelforce_48', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/shipping/parcelforce_48', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true); + + if (isset($this->request->post['shipping_parcelforce_48_rate'])) { + $data['shipping_parcelforce_48_rate'] = $this->request->post['shipping_parcelforce_48_rate']; + } elseif ($this->config->get('shipping_parcelforce_48_rate')) { + $data['shipping_parcelforce_48_rate'] = $this->config->get('shipping_parcelforce_48_rate'); + } else { + $data['shipping_parcelforce_48_rate'] = '10:15.99,12:19.99,14:20.99,16:21.99,18:21.99,20:21.99,22:26.99,24:30.99,26:34.99,28:38.99,30:42.99,35:52.99,40:62.99,45:72.99,50:82.99,55:92.99,60:102.99,65:112.99,70:122.99,75:132.99,80:142.99,85:152.99,90:162.99,95:172.99,100:182.99'; + } + + if (isset($this->request->post['shipping_parcelforce_48_insurance'])) { + $data['shipping_parcelforce_48_insurance'] = $this->request->post['shipping_parcelforce_48_insurance']; + } elseif ($this->config->get('shipping_parcelforce_48_insurance')) { + $data['shipping_parcelforce_48_insurance'] = $this->config->get('shipping_parcelforce_48_insurance'); + } else { + $data['shipping_parcelforce_48_insurance'] = '150:0,500:12,1000:24,1500:36,2000:48,2500:60'; + } + + if (isset($this->request->post['shipping_parcelforce_48_display_weight'])) { + $data['shipping_parcelforce_48_display_weight'] = $this->request->post['shipping_parcelforce_48_display_weight']; + } else { + $data['shipping_parcelforce_48_display_weight'] = $this->config->get('shipping_parcelforce_48_display_weight'); + } + + if (isset($this->request->post['shipping_parcelforce_48_display_insurance'])) { + $data['shipping_parcelforce_48_display_insurance'] = $this->request->post['shipping_parcelforce_48_display_insurance']; + } else { + $data['shipping_parcelforce_48_display_insurance'] = $this->config->get('shipping_parcelforce_48_display_insurance'); + } + + if (isset($this->request->post['shipping_parcelforce_48_display_time'])) { + $data['shipping_parcelforce_48_display_time'] = $this->request->post['shipping_parcelforce_48_display_time']; + } else { + $data['shipping_parcelforce_48_display_time'] = $this->config->get('shipping_parcelforce_48_display_time'); + } + + if (isset($this->request->post['shipping_parcelforce_48_tax_class_id'])) { + $data['shipping_parcelforce_48_tax_class_id'] = $this->request->post['shipping_parcelforce_48_tax_class_id']; + } else { + $data['shipping_parcelforce_48_tax_class_id'] = $this->config->get('shipping_parcelforce_48_tax_class_id'); + } + + $this->load->model('localisation/tax_class'); + + $data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses(); + + if (isset($this->request->post['shipping_parcelforce_48_geo_zone_id'])) { + $data['shipping_parcelforce_48_geo_zone_id'] = $this->request->post['shipping_parcelforce_48_geo_zone_id']; + } else { + $data['shipping_parcelforce_48_geo_zone_id'] = $this->config->get('shipping_parcelforce_48_geo_zone_id'); + } + + $this->load->model('localisation/geo_zone'); + + $data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones(); + + if (isset($this->request->post['shipping_parcelforce_48_status'])) { + $data['shipping_parcelforce_48_status'] = $this->request->post['shipping_parcelforce_48_status']; + } else { + $data['shipping_parcelforce_48_status'] = $this->config->get('shipping_parcelforce_48_status'); + } + + if (isset($this->request->post['shipping_parcelforce_48_sort_order'])) { + $data['shipping_parcelforce_48_sort_order'] = $this->request->post['shipping_parcelforce_48_sort_order']; + } else { + $data['shipping_parcelforce_48_sort_order'] = $this->config->get('shipping_parcelforce_48_sort_order'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/shipping/parcelforce_48', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/shipping/parcelforce_48')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + return !$this->error; + } +}
\ No newline at end of file diff --git a/public/admin/controller/extension/shipping/pickup.php b/public/admin/controller/extension/shipping/pickup.php new file mode 100644 index 0000000..7347148 --- /dev/null +++ b/public/admin/controller/extension/shipping/pickup.php @@ -0,0 +1,83 @@ +<?php +class ControllerExtensionShippingPickup extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/shipping/pickup'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/setting'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('shipping_pickup', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/shipping/pickup', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/shipping/pickup', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true); + + if (isset($this->request->post['shipping_pickup_geo_zone_id'])) { + $data['shipping_pickup_geo_zone_id'] = $this->request->post['shipping_pickup_geo_zone_id']; + } else { + $data['shipping_pickup_geo_zone_id'] = $this->config->get('shipping_pickup_geo_zone_id'); + } + + $this->load->model('localisation/geo_zone'); + + $data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones(); + + if (isset($this->request->post['shipping_pickup_status'])) { + $data['shipping_pickup_status'] = $this->request->post['shipping_pickup_status']; + } else { + $data['shipping_pickup_status'] = $this->config->get('shipping_pickup_status'); + } + + if (isset($this->request->post['shipping_pickup_sort_order'])) { + $data['shipping_pickup_sort_order'] = $this->request->post['shipping_pickup_sort_order']; + } else { + $data['shipping_pickup_sort_order'] = $this->config->get('shipping_pickup_sort_order'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/shipping/pickup', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/shipping/pickup')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + return !$this->error; + } +}
\ No newline at end of file diff --git a/public/admin/controller/extension/shipping/royal_mail.php b/public/admin/controller/extension/shipping/royal_mail.php new file mode 100644 index 0000000..34f446b --- /dev/null +++ b/public/admin/controller/extension/shipping/royal_mail.php @@ -0,0 +1,403 @@ +<?php +class ControllerExtensionShippingRoyalMail extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/shipping/royal_mail'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/setting'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('shipping_royal_mail', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/shipping/royal_mail', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/shipping/royal_mail', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true); + + // Special Delivery < 500 + if (isset($this->request->post['shipping_royal_mail_special_delivery_500_rate'])) { + $data['shipping_royal_mail_special_delivery_500_rate'] = $this->request->post['shipping_royal_mail_special_delivery_500_rate']; + } elseif ($this->config->has('shipping_royal_mail_special_delivery_500_rate')) { + $data['shipping_royal_mail_special_delivery_500_rate'] = $this->config->get('shipping_royal_mail_special_delivery_500_rate'); + } else { + $data['shipping_royal_mail_special_delivery_500_rate'] = '0.1:6.40,0.5:7.15,1:8.45,2:11.00,10:26.60,20:41.20'; + } + + if (isset($this->request->post['shipping_royal_mail_special_delivery_500_insurance'])) { + $data['shipping_royal_mail_special_delivery_500_insurance'] = $this->request->post['shipping_royal_mail_special_delivery_500_insurance']; + } elseif ($this->config->has('shipping_royal_mail_special_delivery_500_insurance')) { + $data['shipping_royal_mail_special_delivery_500_insurance'] = $this->config->get('shipping_royal_mail_special_delivery_500_insurance'); + } else { + $data['shipping_royal_mail_special_delivery_500_insurance'] = '0:500'; + } + + if (isset($this->request->post['shipping_royal_mail_special_delivery_500_status'])) { + $data['shipping_royal_mail_special_delivery_500_status'] = $this->request->post['shipping_royal_mail_special_delivery_500_status']; + } else { + $data['shipping_royal_mail_special_delivery_500_status'] = $this->config->get('shipping_royal_mail_special_delivery_500_status'); + } + + // Special Delivery < 1000 + if (isset($this->request->post['shipping_royal_mail_special_delivery_1000_rate'])) { + $data['shipping_royal_mail_special_delivery_1000_rate'] = $this->request->post['shipping_royal_mail_special_delivery_1000_rate']; + } elseif ($this->config->has('shipping_royal_mail_special_delivery_1000_rate')) { + $data['shipping_royal_mail_special_delivery_1000_rate'] = $this->config->get('shipping_royal_mail_special_delivery_1000_rate'); + } else { + $data['shipping_royal_mail_special_delivery_1000_rate'] = '0.1:7.40,0.5:8.15,1:9.45,2:12.00,10:27.60,20:42.20'; + } + + if (isset($this->request->post['shipping_royal_mail_special_delivery_1000_insurance'])) { + $data['shipping_royal_mail_special_delivery_1000_insurance'] = $this->request->post['shipping_royal_mail_special_delivery_1000_insurance']; + } elseif ($this->config->has('shipping_royal_mail_special_delivery_1000_insurance')) { + $data['shipping_royal_mail_special_delivery_1000_insurance'] = $this->config->get('shipping_royal_mail_special_delivery_1000_insurance'); + } else { + $data['shipping_royal_mail_special_delivery_1000_insurance'] = '0:1000'; + } + + if (isset($this->request->post['shipping_royal_mail_special_delivery_1000_status'])) { + $data['shipping_royal_mail_special_delivery_1000_status'] = $this->request->post['shipping_royal_mail_special_delivery_1000_status']; + } else { + $data['shipping_royal_mail_special_delivery_1000_status'] = $this->config->get('shipping_royal_mail_special_delivery_1000_status'); + } + + // Special Delivery < 2500 + if (isset($this->request->post['shipping_royal_mail_special_delivery_2500_rate'])) { + $data['shipping_royal_mail_special_delivery_2500_rate'] = $this->request->post['shipping_royal_mail_special_delivery_2500_rate']; + } elseif ($this->config->has('shipping_royal_mail_special_delivery_2500_rate')) { + $data['shipping_royal_mail_special_delivery_2500_rate'] = $this->config->get('shipping_royal_mail_special_delivery_2500_rate'); + } else { + $data['shipping_royal_mail_special_delivery_2500_rate'] = '0.1:9.40,0.5:10.15,1:11.45,2:14.00,10:29.60,20:44.20'; + } + + if (isset($this->request->post['shipping_royal_mail_special_delivery_2500_insurance'])) { + $data['shipping_royal_mail_special_delivery_2500_insurance'] = $this->request->post['shipping_royal_mail_special_delivery_2500_insurance']; + } elseif ($this->config->has('shipping_royal_mail_special_delivery_2500_insurance')) { + $data['shipping_royal_mail_special_delivery_2500_insurance'] = $this->config->get('shipping_royal_mail_special_delivery_2500_insurance'); + } else { + $data['shipping_royal_mail_special_delivery_2500_insurance'] = '0:2500'; + } + + if (isset($this->request->post['shipping_royal_mail_special_delivery_2500_status'])) { + $data['shipping_royal_mail_special_delivery_2500_status'] = $this->request->post['shipping_royal_mail_special_delivery_2500_status']; + } else { + $data['shipping_royal_mail_special_delivery_2500_status'] = $this->config->get('shipping_royal_mail_special_delivery_2500_status'); + } + + // 1st Class Signed + if (isset($this->request->post['shipping_royal_mail_1st_class_signed_rate'])) { + $data['shipping_royal_mail_1st_class_signed_rate'] = $this->request->post['shipping_royal_mail_1st_class_signed_rate']; + } elseif ($this->config->has('shipping_royal_mail_1st_class_signed_rate')) { + $data['shipping_royal_mail_1st_class_signed_rate'] = $this->config->get('shipping_royal_mail_1st_class_signed_rate'); + } else { + $data['shipping_royal_mail_1st_class_signed_rate'] = '0.1:2.03,0.25:2.34,0.5:2.75,0.75:3.48,1:6.75,2:10.00,5:16.95,10:23.00,20:34.50'; + } + + if (isset($this->request->post['shipping_royal_mail_1st_class_signed_status'])) { + $data['shipping_royal_mail_1st_class_signed_status'] = $this->request->post['shipping_royal_mail_1st_class_signed_status']; + } else { + $data['shipping_royal_mail_1st_class_signed_status'] = $this->config->get('shipping_royal_mail_1st_class_signed_status'); + } + + // 2nd Class Signed + if (isset($this->request->post['shipping_royal_mail_2nd_class_signed_rate'])) { + $data['shipping_royal_mail_2nd_class_signed_rate'] = $this->request->post['shipping_royal_mail_2nd_class_signed_rate']; + } elseif ($this->config->has('shipping_royal_mail_2nd_class_signed_rate')) { + $data['shipping_royal_mail_2nd_class_signed_rate'] = $this->config->get('shipping_royal_mail_2nd_class_signed_rate'); + } else { + $data['shipping_royal_mail_2nd_class_signed_rate'] = '0.1:1.83,0.25:2.27,0.5:2.58,0.75:3.11,1:6.30,2:9.10,5:14.85,10:21.35,20:29.65'; + } + + if (isset($this->request->post['shipping_royal_mail_2nd_class_signed_status'])) { + $data['shipping_royal_mail_2nd_class_signed_status'] = $this->request->post['shipping_royal_mail_2nd_class_signed_status']; + } else { + $data['shipping_royal_mail_2nd_class_signed_status'] = $this->config->get('shipping_royal_mail_2nd_class_signed_status'); + } + + // 1st Class Standard + if (isset($this->request->post['shipping_royal_mail_1st_class_standard_rate'])) { + $data['shipping_royal_mail_1st_class_standard_rate'] = $this->request->post['shipping_royal_mail_1st_class_standard_rate']; + } elseif ($this->config->has('shipping_royal_mail_1st_class_standard_rate')) { + $data['shipping_royal_mail_1st_class_standard_rate'] = $this->config->get('shipping_royal_mail_1st_class_standard_rate'); + } else { + $data['shipping_royal_mail_1st_class_standard_rate'] = '0.1:0.93,0.25:1.24,0.5:1.65,0.75:2.38,1:5.65,2:8.90,5:15.85,10:21.90,20:33.40'; + } + + if (isset($this->request->post['shipping_royal_mail_1st_class_standard_status'])) { + $data['shipping_royal_mail_1st_class_standard_status'] = $this->request->post['shipping_royal_mail_1st_class_standard_status']; + } else { + $data['shipping_royal_mail_1st_class_standard_status'] = $this->config->get('shipping_royal_mail_1st_class_standard_status'); + } + + // 2nd Class Standard + if (isset($this->request->post['shipping_royal_mail_2nd_class_standard_rate'])) { + $data['shipping_royal_mail_2nd_class_standard_rate'] = $this->request->post['shipping_royal_mail_2nd_class_standard_rate']; + } elseif ($this->config->has('shipping_royal_mail_2nd_class_standard_rate')) { + $data['shipping_royal_mail_2nd_class_standard_rate'] = $this->config->get('shipping_royal_mail_2nd_class_standard_rate'); + } else { + $data['shipping_royal_mail_2nd_class_standard_rate'] = '0.1:0.73,.25:1.17,.5:1.48,.75:2.01,1:5.20,2:8.00,5:13.75,10:20.25,20:28.55'; + } + + if (isset($this->request->post['shipping_royal_mail_2nd_class_standard_status'])) { + $data['shipping_royal_mail_2nd_class_standard_status'] = $this->request->post['shipping_royal_mail_2nd_class_standard_status']; + } else { + $data['shipping_royal_mail_2nd_class_standard_status'] = $this->config->get('shipping_royal_mail_2nd_class_standard_status'); + } + + // International Standard + if (isset($this->request->post['shipping_royal_mail_international_standard_eu_rate'])) { + $data['shipping_royal_mail_international_standard_eu_rate'] = $this->request->post['shipping_royal_mail_international_standard_eu_rate']; + } elseif ($this->config->has('shipping_royal_mail_international_standard_eu_rate')) { + $data['shipping_royal_mail_international_standard_eu_rate'] = $this->config->get('shipping_royal_mail_international_standard_eu_rate'); + } else { + $data['shipping_royal_mail_international_standard_eu_rate'] = '0.01:0.97,0.02:0.97,0.06:1.47,0.1:3.20,0.25:3.70,0.5:5.15,0.75:6.60,1.25:9.50,1.5:10.95,1.75:12.40,2:13.85'; + } + + if (isset($this->request->post['shipping_royal_mail_international_standard_zone_1_rate'])) { + $data['shipping_royal_mail_international_standard_zone_1_rate'] = $this->request->post['shipping_royal_mail_international_standard_zone_1_rate']; + } elseif ($this->config->has('shipping_royal_mail_international_standard_zone_1_rate')) { + $data['shipping_royal_mail_international_standard_zone_1_rate'] = $this->config->get('shipping_royal_mail_international_standard_zone_1_rate'); + } else { + $data['shipping_royal_mail_international_standard_zone_1_rate'] = '0.01:0.97,0.02:1.28,0.06:2.15,0.1:3.80,0.25:4.75,0.5:7.45,0.75:10.15,1:12.85,1.25:15.55,1.5:18.25,1.75:20.95,2:23.65'; + } + + if (isset($this->request->post['shipping_royal_mail_international_standard_zone_2_rate'])) { + $data['shipping_royal_mail_international_standard_zone_2_rate'] = $this->request->post['shipping_royal_mail_international_standard_zone_2_rate']; + } elseif ($this->config->has('shipping_royal_mail_international_standard_zone_2_rate')) { + $data['shipping_royal_mail_international_standard_zone_2_rate'] = $this->config->get('shipping_royal_mail_international_standard_zone_2_rate'); + } else { + $data['shipping_royal_mail_international_standard_zone_2_rate'] = '0.01:0.97,0.02:1.28,0.06:2.15,0.1:4.00,0.25:5.05,0.5:7.90,0.75:10.75,1:13.60,1.25:16.45,1.5:19.30,1.75:22.15,2:25.00'; + } + + if (isset($this->request->post['shipping_royal_mail_international_standard_status'])) { + $data['shipping_royal_mail_international_standard_status'] = $this->request->post['shipping_royal_mail_international_standard_status']; + } else { + $data['shipping_royal_mail_international_standard_status'] = $this->config->get('shipping_royal_mail_international_standard_status'); + } + + // International Tracked & Signed + if (isset($this->request->post['shipping_royal_mail_international_tracked_signed_eu_rate'])) { + $data['shipping_royal_mail_international_tracked_signed_eu_rate'] = $this->request->post['shipping_royal_mail_international_tracked_signed_eu_rate']; + } elseif ($this->config->has('shipping_royal_mail_international_tracked_signed_eu_rate')) { + $data['shipping_royal_mail_international_tracked_signed_eu_rate'] = $this->config->get('shipping_royal_mail_international_tracked_signed_eu_rate'); + } else { + $data['shipping_royal_mail_international_tracked_signed_eu_rate'] = '0.02:5.97,0.06:6.47,0.1:8.20,0.25:8.70,0.50:10.15,0.75:11.60,1:13.05,1.25:14.50,1.5:15.95,1.75:17.40,2:18.85'; + } + + if (isset($this->request->post['shipping_royal_mail_international_tracked_signed_zone_1_rate'])) { + $data['shipping_royal_mail_international_tracked_signed_zone_1_rate'] = $this->request->post['shipping_royal_mail_international_tracked_signed_zone_1_rate']; + } elseif ($this->config->has('shipping_royal_mail_international_tracked_signed_zone_1_rate')) { + $data['shipping_royal_mail_international_tracked_signed_zone_1_rate'] = $this->config->get('shipping_royal_mail_international_tracked_signed_zone_1_rate'); + } else { + $data['shipping_royal_mail_international_tracked_signed_zone_1_rate'] = '0.02:6.28,0.06:7.15,0.1:8.80,0.25:9.75,0.5:12.45,0.75:15.15,1:17.85,1.25:20.55,1.5:23.25,1.75:25.95,2:28.65'; + } + + if (isset($this->request->post['shipping_royal_mail_international_tracked_signed_zone_2_rate'])) { + $data['shipping_royal_mail_international_tracked_signed_zone_2_rate'] = $this->request->post['shipping_royal_mail_international_tracked_signed_zone_2_rate']; + } elseif ($this->config->has('shipping_royal_mail_international_tracked_signed_zone_2_rate')) { + $data['shipping_royal_mail_international_tracked_signed_zone_2_rate'] = $this->config->get('shipping_royal_mail_international_tracked_signed_zone_2_rate'); + } else { + $data['shipping_royal_mail_international_tracked_signed_zone_2_rate'] = '0.02:6.28,0.06:7.15,0.1:9.00,0.25:10.05,0.5:12.90,0.75:15.75,1:18.60,1.25:21.45,1.5:24.30,1.75:27.15,2:30.00'; + } + + if (isset($this->request->post['shipping_royal_mail_international_tracked_signed_status'])) { + $data['shipping_royal_mail_international_tracked_signed_status'] = $this->request->post['shipping_royal_mail_international_tracked_signed_status']; + } else { + $data['shipping_royal_mail_international_tracked_signed_status'] = $this->config->get('shipping_royal_mail_international_tracked_signed_status'); + } + + // International Tracked + // Europe + if (isset($this->request->post['shipping_royal_mail_international_tracked_eu_rate'])) { + $data['shipping_royal_mail_international_tracked_eu_rate'] = $this->request->post['shipping_royal_mail_international_tracked_eu_rate']; + } elseif ($this->config->has('shipping_royal_mail_international_tracked_eu_rate')) { + $data['shipping_royal_mail_international_tracked_eu_rate'] = $this->config->get('shipping_royal_mail_international_tracked_eu_rate'); + } else { + $data['shipping_royal_mail_international_tracked_eu_rate'] = '0.02:7.16,0.06:7.76,0.1:9.84,0.25:10.44,0.5:12.18,0.75:13.92,1:15.66,1.25:17.40,1.5:19.14,1.75:20.88,2:22.62'; + } + + // International Tracked + // Non Europe + if (isset($this->request->post['shipping_royal_mail_international_tracked_non_eu_rate'])) { + $data['shipping_royal_mail_international_tracked_non_eu_rate'] = $this->request->post['shipping_royal_mail_international_tracked_non_eu_rate']; + } elseif ($this->config->has('shipping_royal_mail_international_tracked_non_eu_rate')) { + $data['shipping_royal_mail_international_tracked_non_eu_rate'] = $this->config->get('shipping_royal_mail_international_tracked_non_eu_rate'); + } else { + $data['shipping_royal_mail_international_tracked_non_eu_rate'] = '0.02:5.97,0.06:6.47,0.1:8.20,0.25:8.70,0.5:10.15,0.75:11.60,1:13.05,1.25:14.50,1.5:15.95,1.75:17.40,2:18.85'; + } + + // International Tracked + // World Zones 1 + if (isset($this->request->post['shipping_royal_mail_international_tracked_zone_1_rate'])) { + $data['shipping_royal_mail_international_tracked_zone_1_rate'] = $this->request->post['shipping_royal_mail_international_tracked_zone_1_rate']; + } elseif ($this->config->has('shipping_royal_mail_international_tracked_zone_1_rate')) { + $data['shipping_royal_mail_international_tracked_zone_1_rate'] = $this->config->get('shipping_royal_mail_international_tracked_zone_1_rate'); + } else { + $data['shipping_royal_mail_international_tracked_zone_1_rate'] = '0.02:5.97,0.06:6.47,0.1:8.80,0.25:9.75,0.5:12.45,0.75:15.15,1:17.85,1.25:20.55,1.5:23.25,1.75:25.95,2:28.65'; + } + + // International Tracked + // World Zones 2 + if (isset($this->request->post['shipping_royal_mail_international_tracked_zone_2_rate'])) { + $data['shipping_royal_mail_international_tracked_zone_2_rate'] = $this->request->post['shipping_royal_mail_international_tracked_zone_2_rate']; + } elseif ($this->config->has('shipping_royal_mail_international_tracked_zone_2_rate')) { + $data['shipping_royal_mail_international_tracked_zone_2_rate'] = $this->config->get('shipping_royal_mail_international_tracked_zone_2_rate'); + } else { + $data['shipping_royal_mail_international_tracked_zone_2_rate'] = '0.02:6.28,0.06:7.15,0.1:9.00,0.25:10.05,0.5:12.90,0.75:15.75,1:18.60,1.25:21.45,1.5:24.30,1.75:27.15,2:30.00'; + } + + if (isset($this->request->post['shipping_royal_mail_international_tracked_status'])) { + $data['shipping_royal_mail_international_tracked_status'] = $this->request->post['shipping_royal_mail_international_tracked_status']; + } else { + $data['shipping_royal_mail_international_tracked_status'] = $this->config->get('shipping_royal_mail_international_tracked_status'); + } + + // International Signed + // Europe + if (isset($this->request->post['shipping_royal_mail_international_signed_eu_rate'])) { + $data['shipping_royal_mail_international_signed_eu_rate'] = $this->request->post['shipping_royal_mail_international_signed_eu_rate']; + } elseif ($this->config->has('shipping_royal_mail_international_signed_eu_rate')) { + $data['shipping_royal_mail_international_signed_eu_rate'] = $this->config->get('shipping_royal_mail_international_signed_eu_rate'); + } else { + $data['shipping_royal_mail_international_signed_eu_rate'] = '0.02:5.97,0.06:6.47,0.1:8.20,0.25:8.70,0.5:10.15,0.75:11.60,1:13.05,1.25:14.50,1.5:15.95,1.75:17.40,2:18.85'; + } + + // International Signed + // World Zones 1 + if (isset($this->request->post['shipping_royal_mail_international_signed_zone_1_rate'])) { + $data['shipping_royal_mail_international_signed_zone_1_rate'] = $this->request->post['shipping_royal_mail_international_signed_zone_1_rate']; + } elseif ($this->config->has('shipping_royal_mail_international_signed_zone_1_rate')) { + $data['shipping_royal_mail_international_signed_zone_1_rate'] = $this->config->get('shipping_royal_mail_international_signed_zone_1_rate'); + } else { + $data['shipping_royal_mail_international_signed_zone_1_rate'] = '0.02:6.28,0.06:7.15,0.1:8.80,0.25:9.75,0.5:12.45,0.75:15.15,1:17.85,1.25:20.55,1.5:23.25,1.75:25.95,2:28.65'; + } + + // International Signed + // World Zones 2 + if (isset($this->request->post['shipping_royal_mail_international_signed_zone_2_rate'])) { + $data['shipping_royal_mail_international_signed_zone_2_rate'] = $this->request->post['shipping_royal_mail_international_signed_zone_2_rate']; + } elseif ($this->config->has('shipping_royal_mail_international_signed_zone_2_rate')) { + $data['shipping_royal_mail_international_signed_zone_2_rate'] = $this->config->get('shipping_royal_mail_international_signed_zone_2_rate'); + } else { + $data['shipping_royal_mail_international_signed_zone_2_rate'] = '0.02:6.28,0.06:7.15,0.1:9.00,0.25:10.05,0.5:12.90,0.75:15.75,1:18.60,1.25:21.45,1.5:24.30,1.75:27.15,2:30.00'; + } + + if (isset($this->request->post['shipping_royal_mail_international_signed_status'])) { + $data['shipping_royal_mail_international_signed_status'] = $this->request->post['shipping_royal_mail_international_signed_status']; + } else { + $data['shipping_royal_mail_international_signed_status'] = $this->config->get('shipping_royal_mail_international_signed_status'); + } + + // International Economy + if (isset($this->request->post['shipping_royal_mail_international_economy_rate'])) { + $data['shipping_royal_mail_international_economy_rate'] = $this->request->post['shipping_royal_mail_international_economy_rate']; + } elseif ($this->config->has('shipping_royal_mail_international_economy_rate')) { + $data['shipping_royal_mail_international_economy_rate'] = $this->config->get('shipping_royal_mail_international_economy_rate'); + } else { + $data['shipping_royal_mail_international_economy_rate'] = '0.02:0.81,0.06:1.43,0.1:2.80,0.25:3.65,0.5:5.10,0.75:6.55,1:8.00,1.25:9.45,1.5:10.90,1.75:12.35,2:13.80'; + } + + if (isset($this->request->post['shipping_royal_mail_international_economy_status'])) { + $data['shipping_royal_mail_international_economy_status'] = $this->request->post['shipping_royal_mail_international_economy_status']; + } else { + $data['shipping_royal_mail_international_economy_status'] = $this->config->get('shipping_royal_mail_international_economy_status'); + } + + if (isset($this->request->post['shipping_royal_mail_display_weight'])) { + $data['shipping_royal_mail_display_weight'] = $this->request->post['shipping_royal_mail_display_weight']; + } else { + $data['shipping_royal_mail_display_weight'] = $this->config->get('shipping_royal_mail_display_weight'); + } + + if (isset($this->request->post['shipping_royal_mail_display_insurance'])) { + $data['shipping_royal_mail_display_insurance'] = $this->request->post['shipping_royal_mail_display_insurance']; + } else { + $data['shipping_royal_mail_display_insurance'] = $this->config->get('shipping_royal_mail_display_insurance'); + } + + if (isset($this->request->post['shipping_royal_mail_weight_class_id'])) { + $data['shipping_royal_mail_weight_class_id'] = $this->request->post['shipping_royal_mail_weight_class_id']; + } else { + $data['shipping_royal_mail_weight_class_id'] = $this->config->get('shipping_royal_mail_weight_class_id'); + } + + $this->load->model('localisation/weight_class'); + + $data['weight_classes'] = $this->model_localisation_weight_class->getWeightClasses(); + + if (isset($this->request->post['shipping_royal_mail_tax_class_id'])) { + $data['shipping_royal_mail_tax_class_id'] = $this->request->post['shipping_royal_mail_tax_class_id']; + } else { + $data['shipping_royal_mail_tax_class_id'] = $this->config->get('shipping_royal_mail_tax_class_id'); + } + + $this->load->model('localisation/tax_class'); + + $data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses(); + + if (isset($this->request->post['shipping_royal_mail_geo_zone_id'])) { + $data['shipping_royal_mail_geo_zone_id'] = $this->request->post['shipping_royal_mail_geo_zone_id']; + } else { + $data['shipping_royal_mail_geo_zone_id'] = $this->config->get('shipping_royal_mail_geo_zone_id'); + } + + $this->load->model('localisation/geo_zone'); + + $data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones(); + + if (isset($this->request->post['shipping_royal_mail_status'])) { + $data['shipping_royal_mail_status'] = $this->request->post['shipping_royal_mail_status']; + } else { + $data['shipping_royal_mail_status'] = $this->config->get('shipping_royal_mail_status'); + } + + if (isset($this->request->post['shipping_royal_mail_sort_order'])) { + $data['shipping_royal_mail_sort_order'] = $this->request->post['shipping_royal_mail_sort_order']; + } else { + $data['shipping_royal_mail_sort_order'] = $this->config->get('shipping_royal_mail_sort_order'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/shipping/royal_mail', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/shipping/royal_mail')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + return !$this->error; + } +}
\ No newline at end of file diff --git a/public/admin/controller/extension/shipping/ups.php b/public/admin/controller/extension/shipping/ups.php new file mode 100644 index 0000000..dfb0e4a --- /dev/null +++ b/public/admin/controller/extension/shipping/ups.php @@ -0,0 +1,744 @@ +<?php +class ControllerExtensionShippingUPS extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/shipping/ups'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/setting'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('shipping_ups', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + if (isset($this->error['key'])) { + $data['error_key'] = $this->error['key']; + } else { + $data['error_key'] = ''; + } + + if (isset($this->error['username'])) { + $data['error_username'] = $this->error['username']; + } else { + $data['error_username'] = ''; + } + + if (isset($this->error['password'])) { + $data['error_password'] = $this->error['password']; + } else { + $data['error_password'] = ''; + } + + if (isset($this->error['city'])) { + $data['error_city'] = $this->error['city']; + } else { + $data['error_city'] = ''; + } + + if (isset($this->error['state'])) { + $data['error_state'] = $this->error['state']; + } else { + $data['error_state'] = ''; + } + + if (isset($this->error['country'])) { + $data['error_country'] = $this->error['country']; + } else { + $data['error_country'] = ''; + } + + if (isset($this->error['dimension'])) { + $data['error_dimension'] = $this->error['dimension']; + } else { + $data['error_dimension'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/shipping/ups', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/shipping/ups', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true); + + if (isset($this->request->post['shipping_ups_key'])) { + $data['shipping_ups_key'] = $this->request->post['shipping_ups_key']; + } else { + $data['shipping_ups_key'] = $this->config->get('shipping_ups_key'); + } + + if (isset($this->request->post['shipping_ups_username'])) { + $data['shipping_ups_username'] = $this->request->post['shipping_ups_username']; + } else { + $data['shipping_ups_username'] = $this->config->get('shipping_ups_username'); + } + + if (isset($this->request->post['shipping_ups_password'])) { + $data['shipping_ups_password'] = $this->request->post['shipping_ups_password']; + } else { + $data['shipping_ups_password'] = $this->config->get('shipping_ups_password'); + } + + if (isset($this->request->post['shipping_ups_pickup'])) { + $data['shipping_ups_pickup'] = $this->request->post['shipping_ups_pickup']; + } else { + $data['shipping_ups_pickup'] = $this->config->get('shipping_ups_pickup'); + } + + $data['pickups'] = array(); + + $data['pickups'][] = array( + 'value' => '01', + 'text' => $this->language->get('text_daily_pickup') + ); + + $data['pickups'][] = array( + 'value' => '03', + 'text' => $this->language->get('text_customer_counter') + ); + + $data['pickups'][] = array( + 'value' => '06', + 'text' => $this->language->get('text_one_time_pickup') + ); + + $data['pickups'][] = array( + 'value' => '07', + 'text' => $this->language->get('text_on_call_air_pickup') + ); + + $data['pickups'][] = array( + 'value' => '19', + 'text' => $this->language->get('text_letter_center') + ); + + $data['pickups'][] = array( + 'value' => '20', + 'text' => $this->language->get('text_air_service_center') + ); + + $data['pickups'][] = array( + 'value' => '11', + 'text' => $this->language->get('text_suggested_retail_rates') + ); + + if (isset($this->request->post['shipping_ups_packaging'])) { + $data['shipping_ups_packaging'] = $this->request->post['shipping_ups_packaging']; + } else { + $data['shipping_ups_packaging'] = $this->config->get('shipping_ups_packaging'); + } + + $data['packages'] = array(); + + $data['packages'][] = array( + 'value' => '02', + 'text' => $this->language->get('text_package') + ); + + $data['packages'][] = array( + 'value' => '01', + 'text' => $this->language->get('text_ups_letter') + ); + + $data['packages'][] = array( + 'value' => '03', + 'text' => $this->language->get('text_ups_tube') + ); + + $data['packages'][] = array( + 'value' => '04', + 'text' => $this->language->get('text_ups_pak') + ); + + $data['packages'][] = array( + 'value' => '21', + 'text' => $this->language->get('text_ups_express_box') + ); + + $data['packages'][] = array( + 'value' => '24', + 'text' => $this->language->get('text_ups_25kg_box') + ); + + $data['packages'][] = array( + 'value' => '25', + 'text' => $this->language->get('text_ups_10kg_box') + ); + + if (isset($this->request->post['shipping_ups_classification'])) { + $data['shipping_ups_classification'] = $this->request->post['shipping_ups_classification']; + } else { + $data['shipping_ups_classification'] = $this->config->get('shipping_ups_classification'); + } + + $data['classifications'][] = array( + 'value' => '01', + 'text' => '01' + ); + + $data['classifications'][] = array( + 'value' => '03', + 'text' => '03' + ); + + $data['classifications'][] = array( + 'value' => '04', + 'text' => '04' + ); + + if (isset($this->request->post['shipping_ups_origin'])) { + $data['shipping_ups_origin'] = $this->request->post['shipping_ups_origin']; + } else { + $data['shipping_ups_origin'] = $this->config->get('shipping_ups_origin'); + } + + $data['origins'] = array(); + + $data['origins'][] = array( + 'value' => 'US', + 'text' => $this->language->get('text_us') + ); + + $data['origins'][] = array( + 'value' => 'CA', + 'text' => $this->language->get('text_ca') + ); + + $data['origins'][] = array( + 'value' => 'EU', + 'text' => $this->language->get('text_eu') + ); + + $data['origins'][] = array( + 'value' => 'PR', + 'text' => $this->language->get('text_pr') + ); + + $data['origins'][] = array( + 'value' => 'MX', + 'text' => $this->language->get('text_mx') + ); + + $data['origins'][] = array( + 'value' => 'other', + 'text' => $this->language->get('text_other') + ); + + if (isset($this->request->post['shipping_ups_city'])) { + $data['shipping_ups_city'] = $this->request->post['shipping_ups_city']; + } else { + $data['shipping_ups_city'] = $this->config->get('shipping_ups_city'); + } + + if (isset($this->request->post['shipping_ups_state'])) { + $data['shipping_ups_state'] = $this->request->post['shipping_ups_state']; + } else { + $data['shipping_ups_state'] = $this->config->get('shipping_ups_state'); + } + + if (isset($this->request->post['shipping_ups_country'])) { + $data['shipping_ups_country'] = $this->request->post['shipping_ups_country']; + } else { + $data['shipping_ups_country'] = $this->config->get('shipping_ups_country'); + } + + if (isset($this->request->post['shipping_ups_postcode'])) { + $data['shipping_ups_postcode'] = $this->request->post['shipping_ups_postcode']; + } else { + $data['shipping_ups_postcode'] = $this->config->get('shipping_ups_postcode'); + } + + if (isset($this->request->post['shipping_ups_test'])) { + $data['shipping_ups_test'] = $this->request->post['shipping_ups_test']; + } else { + $data['shipping_ups_test'] = $this->config->get('shipping_ups_test'); + } + + if (isset($this->request->post['shipping_ups_quote_type'])) { + $data['shipping_ups_quote_type'] = $this->request->post['shipping_ups_quote_type']; + } else { + $data['shipping_ups_quote_type'] = $this->config->get('shipping_ups_quote_type'); + } + + $data['quote_types'] = array(); + + $data['quote_types'][] = array( + 'value' => 'residential', + 'text' => $this->language->get('text_residential') + ); + + $data['quote_types'][] = array( + 'value' => 'commercial', + 'text' => $this->language->get('text_commercial') + ); + + // US + if (isset($this->request->post['shipping_ups_us_01'])) { + $data['shipping_ups_us_01'] = $this->request->post['shipping_ups_us_01']; + } else { + $data['shipping_ups_us_01'] = $this->config->get('shipping_ups_us_01'); + } + + if (isset($this->request->post['shipping_ups_us_02'])) { + $data['shipping_ups_us_02'] = $this->request->post['shipping_ups_us_02']; + } else { + $data['shipping_ups_us_02'] = $this->config->get('shipping_ups_us_02'); + } + + if (isset($this->request->post['shipping_ups_us_03'])) { + $data['shipping_ups_us_03'] = $this->request->post['shipping_ups_us_03']; + } else { + $data['shipping_ups_us_03'] = $this->config->get('shipping_ups_us_03'); + } + + if (isset($this->request->post['shipping_ups_us_07'])) { + $data['shipping_ups_us_07'] = $this->request->post['shipping_ups_us_07']; + } else { + $data['shipping_ups_us_07'] = $this->config->get('shipping_ups_us_07'); + } + + if (isset($this->request->post['shipping_ups_us_08'])) { + $data['shipping_ups_us_08'] = $this->request->post['shipping_ups_us_08']; + } else { + $data['shipping_ups_us_08'] = $this->config->get('shipping_ups_us_08'); + } + + if (isset($this->request->post['shipping_ups_us_11'])) { + $data['shipping_ups_us_11'] = $this->request->post['shipping_ups_us_11']; + } else { + $data['shipping_ups_us_11'] = $this->config->get('shipping_ups_us_11'); + } + + if (isset($this->request->post['shipping_ups_us_12'])) { + $data['shipping_ups_us_12'] = $this->request->post['shipping_ups_us_12']; + } else { + $data['shipping_ups_us_12'] = $this->config->get('shipping_ups_us_12'); + } + + if (isset($this->request->post['shipping_ups_us_13'])) { + $data['shipping_ups_us_13'] = $this->request->post['shipping_ups_us_13']; + } else { + $data['shipping_ups_us_13'] = $this->config->get('shipping_ups_us_13'); + } + + if (isset($this->request->post['shipping_ups_us_14'])) { + $data['shipping_ups_us_14'] = $this->request->post['shipping_ups_us_14']; + } else { + $data['shipping_ups_us_14'] = $this->config->get('shipping_ups_us_14'); + } + + if (isset($this->request->post['shipping_ups_us_54'])) { + $data['shipping_ups_us_54'] = $this->request->post['shipping_ups_us_54']; + } else { + $data['shipping_ups_us_54'] = $this->config->get('shipping_ups_us_54'); + } + + if (isset($this->request->post['shipping_ups_us_59'])) { + $data['shipping_ups_us_59'] = $this->request->post['shipping_ups_us_59']; + } else { + $data['shipping_ups_us_59'] = $this->config->get('shipping_ups_us_59'); + } + + if (isset($this->request->post['shipping_ups_us_65'])) { + $data['shipping_ups_us_65'] = $this->request->post['shipping_ups_us_65']; + } else { + $data['shipping_ups_us_65'] = $this->config->get('shipping_ups_us_65'); + } + + // Puerto Rico + if (isset($this->request->post['shipping_ups_pr_01'])) { + $data['shipping_ups_pr_01'] = $this->request->post['shipping_ups_pr_01']; + } else { + $data['shipping_ups_pr_01'] = $this->config->get('shipping_ups_pr_01'); + } + + if (isset($this->request->post['shipping_ups_pr_02'])) { + $data['shipping_ups_pr_02'] = $this->request->post['shipping_ups_pr_02']; + } else { + $data['shipping_ups_pr_02'] = $this->config->get('shipping_ups_pr_02'); + } + + if (isset($this->request->post['shipping_ups_pr_03'])) { + $data['shipping_ups_pr_03'] = $this->request->post['shipping_ups_pr_03']; + } else { + $data['shipping_ups_pr_03'] = $this->config->get('shipping_ups_pr_03'); + } + + if (isset($this->request->post['shipping_ups_pr_07'])) { + $data['shipping_ups_pr_07'] = $this->request->post['shipping_ups_pr_07']; + } else { + $data['shipping_ups_pr_07'] = $this->config->get('shipping_ups_pr_07'); + } + + if (isset($this->request->post['shipping_ups_pr_08'])) { + $data['shipping_ups_pr_08'] = $this->request->post['shipping_ups_pr_08']; + } else { + $data['shipping_ups_pr_08'] = $this->config->get('shipping_ups_pr_08'); + } + + if (isset($this->request->post['shipping_ups_pr_14'])) { + $data['shipping_ups_pr_14'] = $this->request->post['shipping_ups_pr_14']; + } else { + $data['shipping_ups_pr_14'] = $this->config->get('shipping_ups_pr_14'); + } + + if (isset($this->request->post['shipping_ups_pr_54'])) { + $data['shipping_ups_pr_54'] = $this->request->post['shipping_ups_pr_54']; + } else { + $data['shipping_ups_pr_54'] = $this->config->get('shipping_ups_pr_54'); + } + + if (isset($this->request->post['shipping_ups_pr_65'])) { + $data['shipping_ups_pr_65'] = $this->request->post['shipping_ups_pr_65']; + } else { + $data['shipping_ups_pr_65'] = $this->config->get('shipping_ups_pr_65'); + } + + // Canada + if (isset($this->request->post['shipping_ups_ca_01'])) { + $data['shipping_ups_ca_01'] = $this->request->post['shipping_ups_ca_01']; + } else { + $data['shipping_ups_ca_01'] = $this->config->get('shipping_ups_ca_01'); + } + + if (isset($this->request->post['shipping_ups_ca_02'])) { + $data['shipping_ups_ca_02'] = $this->request->post['shipping_ups_ca_02']; + } else { + $data['shipping_ups_ca_02'] = $this->config->get('shipping_ups_ca_02'); + } + + if (isset($this->request->post['shipping_ups_ca_07'])) { + $data['shipping_ups_ca_07'] = $this->request->post['shipping_ups_ca_07']; + } else { + $data['shipping_ups_ca_07'] = $this->config->get('shipping_ups_ca_07'); + } + + if (isset($this->request->post['shipping_ups_ca_08'])) { + $data['shipping_ups_ca_08'] = $this->request->post['shipping_ups_ca_08']; + } else { + $data['shipping_ups_ca_08'] = $this->config->get('shipping_ups_ca_08'); + } + + if (isset($this->request->post['shipping_ups_ca_11'])) { + $data['shipping_ups_ca_11'] = $this->request->post['shipping_ups_ca_11']; + } else { + $data['shipping_ups_ca_11'] = $this->config->get('shipping_ups_ca_11'); + } + + if (isset($this->request->post['shipping_ups_ca_12'])) { + $data['shipping_ups_ca_12'] = $this->request->post['shipping_ups_ca_12']; + } else { + $data['shipping_ups_ca_12'] = $this->config->get('shipping_ups_ca_12'); + } + + if (isset($this->request->post['shipping_ups_ca_13'])) { + $data['shipping_ups_ca_13'] = $this->request->post['shipping_ups_ca_13']; + } else { + $data['shipping_ups_ca_13'] = $this->config->get('shipping_ups_ca_13'); + } + + if (isset($this->request->post['shipping_ups_ca_14'])) { + $data['shipping_ups_ca_14'] = $this->request->post['shipping_ups_ca_14']; + } else { + $data['shipping_ups_ca_14'] = $this->config->get('shipping_ups_ca_14'); + } + + if (isset($this->request->post['shipping_ups_ca_54'])) { + $data['shipping_ups_ca_54'] = $this->request->post['shipping_ups_ca_54']; + } else { + $data['shipping_ups_ca_54'] = $this->config->get('shipping_ups_ca_54'); + } + + if (isset($this->request->post['shipping_ups_ca_65'])) { + $data['shipping_ups_ca_65'] = $this->request->post['shipping_ups_ca_65']; + } else { + $data['shipping_ups_ca_65'] = $this->config->get('shipping_ups_ca_65'); + } + + // Mexico + if (isset($this->request->post['shipping_ups_mx_07'])) { + $data['shipping_ups_mx_07'] = $this->request->post['shipping_ups_mx_07']; + } else { + $data['shipping_ups_mx_07'] = $this->config->get('shipping_ups_mx_07'); + } + + if (isset($this->request->post['shipping_ups_mx_08'])) { + $data['shipping_ups_mx_08'] = $this->request->post['shipping_ups_mx_08']; + } else { + $data['shipping_ups_mx_08'] = $this->config->get('shipping_ups_mx_08'); + } + + if (isset($this->request->post['shipping_ups_mx_54'])) { + $data['shipping_ups_mx_54'] = $this->request->post['shipping_ups_mx_54']; + } else { + $data['shipping_ups_mx_54'] = $this->config->get('shipping_ups_mx_54'); + } + + if (isset($this->request->post['shipping_ups_mx_65'])) { + $data['shipping_ups_mx_65'] = $this->request->post['shipping_ups_mx_65']; + } else { + $data['shipping_ups_mx_65'] = $this->config->get('shipping_ups_mx_65'); + } + + // EU + if (isset($this->request->post['shipping_ups_eu_07'])) { + $data['shipping_ups_eu_07'] = $this->request->post['shipping_ups_eu_07']; + } else { + $data['shipping_ups_eu_07'] = $this->config->get('shipping_ups_eu_07'); + } + + if (isset($this->request->post['shipping_ups_eu_08'])) { + $data['shipping_ups_eu_08'] = $this->request->post['shipping_ups_eu_08']; + } else { + $data['shipping_ups_eu_08'] = $this->config->get('shipping_ups_eu_08'); + } + + if (isset($this->request->post['shipping_ups_eu_11'])) { + $data['shipping_ups_eu_11'] = $this->request->post['shipping_ups_eu_11']; + } else { + $data['shipping_ups_eu_11'] = $this->config->get('shipping_ups_eu_11'); + } + + if (isset($this->request->post['shipping_ups_eu_54'])) { + $data['shipping_ups_eu_54'] = $this->request->post['shipping_ups_eu_54']; + } else { + $data['shipping_ups_eu_54'] = $this->config->get('shipping_ups_eu_54'); + } + + if (isset($this->request->post['shipping_ups_eu_65'])) { + $data['shipping_ups_eu_65'] = $this->request->post['shipping_ups_eu_65']; + } else { + $data['shipping_ups_eu_65'] = $this->config->get('shipping_ups_eu_65'); + } + + if (isset($this->request->post['shipping_ups_eu_82'])) { + $data['shipping_ups_eu_82'] = $this->request->post['shipping_ups_eu_82']; + } else { + $data['shipping_ups_eu_82'] = $this->config->get('shipping_ups_eu_82'); + } + + if (isset($this->request->post['shipping_ups_eu_83'])) { + $data['shipping_ups_eu_83'] = $this->request->post['shipping_ups_eu_83']; + } else { + $data['shipping_ups_eu_83'] = $this->config->get('shipping_ups_eu_83'); + } + + if (isset($this->request->post['shipping_ups_eu_84'])) { + $data['shipping_ups_eu_84'] = $this->request->post['shipping_ups_eu_84']; + } else { + $data['shipping_ups_eu_84'] = $this->config->get('shipping_ups_eu_84'); + } + + if (isset($this->request->post['shipping_ups_eu_85'])) { + $data['shipping_ups_eu_85'] = $this->request->post['shipping_ups_eu_85']; + } else { + $data['shipping_ups_eu_85'] = $this->config->get('shipping_ups_eu_85'); + } + + if (isset($this->request->post['shipping_ups_eu_86'])) { + $data['shipping_ups_eu_86'] = $this->request->post['shipping_ups_eu_86']; + } else { + $data['shipping_ups_eu_86'] = $this->config->get('shipping_ups_eu_86'); + } + + // Other + if (isset($this->request->post['shipping_ups_other_07'])) { + $data['shipping_ups_other_07'] = $this->request->post['shipping_ups_other_07']; + } else { + $data['shipping_ups_other_07'] = $this->config->get('shipping_ups_other_07'); + } + + if (isset($this->request->post['shipping_ups_other_08'])) { + $data['shipping_ups_other_08'] = $this->request->post['shipping_ups_other_08']; + } else { + $data['shipping_ups_other_08'] = $this->config->get('shipping_ups_other_08'); + } + + if (isset($this->request->post['shipping_ups_other_11'])) { + $data['shipping_ups_other_11'] = $this->request->post['shipping_ups_other_11']; + } else { + $data['shipping_ups_other_11'] = $this->config->get('shipping_ups_other_11'); + } + + if (isset($this->request->post['shipping_ups_other_54'])) { + $data['shipping_ups_other_54'] = $this->request->post['shipping_ups_other_54']; + } else { + $data['shipping_ups_other_54'] = $this->config->get('shipping_ups_other_54'); + } + + if (isset($this->request->post['shipping_ups_other_65'])) { + $data['shipping_ups_other_65'] = $this->request->post['shipping_ups_other_65']; + } else { + $data['shipping_ups_other_65'] = $this->config->get('shipping_ups_other_65'); + } + + if (isset($this->request->post['shipping_ups_display_weight'])) { + $data['shipping_ups_display_weight'] = $this->request->post['shipping_ups_display_weight']; + } else { + $data['shipping_ups_display_weight'] = $this->config->get('shipping_ups_display_weight'); + } + + if (isset($this->request->post['shipping_ups_insurance'])) { + $data['shipping_ups_insurance'] = $this->request->post['shipping_ups_insurance']; + } else { + $data['shipping_ups_insurance'] = $this->config->get('shipping_ups_insurance'); + } + + if (isset($this->request->post['shipping_ups_weight_class_id'])) { + $data['shipping_ups_weight_class_id'] = $this->request->post['shipping_ups_weight_class_id']; + } else { + $data['shipping_ups_weight_class_id'] = $this->config->get('shipping_ups_weight_class_id'); + } + + $this->load->model('localisation/weight_class'); + + $data['weight_classes'] = $this->model_localisation_weight_class->getWeightClasses(); + + if (isset($this->request->post['shipping_ups_length_code'])) { + $data['shipping_ups_length_code'] = $this->request->post['shipping_ups_length_code']; + } else { + $data['shipping_ups_length_code'] = $this->config->get('shipping_ups_length_code'); + } + + if (isset($this->request->post['shipping_ups_length_class_id'])) { + $data['shipping_ups_length_class_id'] = $this->request->post['shipping_ups_length_class_id']; + } else { + $data['shipping_ups_length_class_id'] = $this->config->get('shipping_ups_length_class_id'); + } + + $this->load->model('localisation/length_class'); + + $data['length_classes'] = $this->model_localisation_length_class->getLengthClasses(); + + if (isset($this->request->post['shipping_ups_length'])) { + $data['shipping_ups_length'] = $this->request->post['shipping_ups_length']; + } else { + $data['shipping_ups_length'] = $this->config->get('shipping_ups_length'); + } + + if (isset($this->request->post['shipping_ups_width'])) { + $data['shipping_ups_width'] = $this->request->post['shipping_ups_width']; + } else { + $data['shipping_ups_width'] = $this->config->get('shipping_ups_width'); + } + + if (isset($this->request->post['shipping_ups_height'])) { + $data['shipping_ups_height'] = $this->request->post['shipping_ups_height']; + } else { + $data['shipping_ups_height'] = $this->config->get('shipping_ups_height'); + } + + if (isset($this->request->post['shipping_ups_tax_class_id'])) { + $data['shipping_ups_tax_class_id'] = $this->request->post['shipping_ups_tax_class_id']; + } else { + $data['shipping_ups_tax_class_id'] = $this->config->get('shipping_ups_tax_class_id'); + } + + $this->load->model('localisation/tax_class'); + + $data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses(); + + if (isset($this->request->post['shipping_ups_geo_zone_id'])) { + $data['shipping_ups_geo_zone_id'] = $this->request->post['shipping_ups_geo_zone_id']; + } else { + $data['shipping_ups_geo_zone_id'] = $this->config->get('shipping_ups_geo_zone_id'); + } + + $this->load->model('localisation/geo_zone'); + + $data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones(); + + if (isset($this->request->post['shipping_ups_status'])) { + $data['shipping_ups_status'] = $this->request->post['shipping_ups_status']; + } else { + $data['shipping_ups_status'] = $this->config->get('shipping_ups_status'); + } + + if (isset($this->request->post['shipping_ups_sort_order'])) { + $data['shipping_ups_sort_order'] = $this->request->post['shipping_ups_sort_order']; + } else { + $data['shipping_ups_sort_order'] = $this->config->get('shipping_ups_sort_order'); + } + + if (isset($this->request->post['shipping_ups_debug'])) { + $data['shipping_ups_debug'] = $this->request->post['shipping_ups_debug']; + } else { + $data['shipping_ups_debug'] = $this->config->get('shipping_ups_debug'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/shipping/ups', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/shipping/ups')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + if (!$this->request->post['shipping_ups_key']) { + $this->error['key'] = $this->language->get('error_key'); + } + + if (!$this->request->post['shipping_ups_username']) { + $this->error['username'] = $this->language->get('error_username'); + } + + if (!$this->request->post['shipping_ups_password']) { + $this->error['password'] = $this->language->get('error_password'); + } + + if (!$this->request->post['shipping_ups_city']) { + $this->error['city'] = $this->language->get('error_city'); + } + + if (!$this->request->post['shipping_ups_state']) { + $this->error['state'] = $this->language->get('error_state'); + } + + if (!$this->request->post['shipping_ups_country']) { + $this->error['country'] = $this->language->get('error_country'); + } + + if (empty($this->request->post['shipping_ups_length'])) { + $this->error['dimension'] = $this->language->get('error_dimension'); + } + + if (empty($this->request->post['shipping_ups_width'])) { + $this->error['dimension'] = $this->language->get('error_dimension'); + } + + if (empty($this->request->post['shipping_ups_height'])) { + $this->error['dimension'] = $this->language->get('error_dimension'); + } + + return !$this->error; + } +}
\ No newline at end of file diff --git a/public/admin/controller/extension/shipping/usps.php b/public/admin/controller/extension/shipping/usps.php new file mode 100644 index 0000000..503e35a --- /dev/null +++ b/public/admin/controller/extension/shipping/usps.php @@ -0,0 +1,464 @@ +<?php +class ControllerExtensionShippingUsps extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/shipping/usps'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/setting'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('shipping_usps', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + if (isset($this->error['user_id'])) { + $data['error_user_id'] = $this->error['user_id']; + } else { + $data['error_user_id'] = ''; + } + + if (isset($this->error['postcode'])) { + $data['error_postcode'] = $this->error['postcode']; + } else { + $data['error_postcode'] = ''; + } + + if (isset($this->error['dimension'])) { + $data['error_dimension'] = $this->error['dimension']; + } else { + $data['error_dimension'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/shipping/usps', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/shipping/usps', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true); + + if (isset($this->request->post['shipping_usps_user_id'])) { + $data['shipping_usps_user_id'] = $this->request->post['shipping_usps_user_id']; + } else { + $data['shipping_usps_user_id'] = $this->config->get('shipping_usps_user_id'); + } + + if (isset($this->request->post['shipping_usps_postcode'])) { + $data['shipping_usps_postcode'] = $this->request->post['shipping_usps_postcode']; + } else { + $data['shipping_usps_postcode'] = $this->config->get('shipping_usps_postcode'); + } + + if (isset($this->request->post['shipping_usps_domestic_00'])) { + $data['shipping_usps_domestic_00'] = $this->request->post['shipping_usps_domestic_00']; + } else { + $data['shipping_usps_domestic_00'] = $this->config->get('shipping_usps_domestic_00'); + } + + if (isset($this->request->post['shipping_usps_domestic_01'])) { + $data['shipping_usps_domestic_01'] = $this->request->post['shipping_usps_domestic_01']; + } else { + $data['shipping_usps_domestic_01'] = $this->config->get('shipping_usps_domestic_01'); + } + + if (isset($this->request->post['shipping_usps_domestic_02'])) { + $data['shipping_usps_domestic_02'] = $this->request->post['shipping_usps_domestic_02']; + } else { + $data['shipping_usps_domestic_02'] = $this->config->get('shipping_usps_domestic_02'); + } + + if (isset($this->request->post['shipping_usps_domestic_03'])) { + $data['shipping_usps_domestic_03'] = $this->request->post['shipping_usps_domestic_03']; + } else { + $data['shipping_usps_domestic_03'] = $this->config->get('shipping_usps_domestic_03'); + } + + if (isset($this->request->post['shipping_usps_domestic_1'])) { + $data['shipping_usps_domestic_1'] = $this->request->post['shipping_usps_domestic_1']; + } else { + $data['shipping_usps_domestic_1'] = $this->config->get('shipping_usps_domestic_1'); + } + + if (isset($this->request->post['shipping_usps_domestic_2'])) { + $data['shipping_usps_domestic_2'] = $this->request->post['shipping_usps_domestic_2']; + } else { + $data['shipping_usps_domestic_2'] = $this->config->get('shipping_usps_domestic_2'); + } + + if (isset($this->request->post['shipping_usps_domestic_3'])) { + $data['shipping_usps_domestic_3'] = $this->request->post['shipping_usps_domestic_3']; + } else { + $data['shipping_usps_domestic_3'] = $this->config->get('shipping_usps_domestic_3'); + } + + if (isset($this->request->post['shipping_usps_domestic_4'])) { + $data['shipping_usps_domestic_4'] = $this->request->post['shipping_usps_domestic_4']; + } else { + $data['shipping_usps_domestic_4'] = $this->config->get('shipping_usps_domestic_4'); + } + + if (isset($this->request->post['shipping_usps_domestic_5'])) { + $data['shipping_usps_domestic_5'] = $this->request->post['shipping_usps_domestic_5']; + } else { + $data['shipping_usps_domestic_5'] = $this->config->get('shipping_usps_domestic_5'); + } + + if (isset($this->request->post['shipping_usps_domestic_6'])) { + $data['shipping_usps_domestic_6'] = $this->request->post['shipping_usps_domestic_6']; + } else { + $data['shipping_usps_domestic_6'] = $this->config->get('shipping_usps_domestic_6'); + } + + if (isset($this->request->post['shipping_usps_domestic_7'])) { + $data['shipping_usps_domestic_7'] = $this->request->post['shipping_usps_domestic_7']; + } else { + $data['shipping_usps_domestic_7'] = $this->config->get('shipping_usps_domestic_7'); + } + + if (isset($this->request->post['shipping_usps_domestic_12'])) { + $data['shipping_usps_domestic_12'] = $this->request->post['shipping_usps_domestic_12']; + } else { + $data['shipping_usps_domestic_12'] = $this->config->get('shipping_usps_domestic_12'); + } + + if (isset($this->request->post['shipping_usps_domestic_13'])) { + $data['shipping_usps_domestic_13'] = $this->request->post['shipping_usps_domestic_13']; + } else { + $data['shipping_usps_domestic_13'] = $this->config->get('shipping_usps_domestic_13'); + } + + if (isset($this->request->post['shipping_usps_domestic_16'])) { + $data['shipping_usps_domestic_16'] = $this->request->post['shipping_usps_domestic_16']; + } else { + $data['shipping_usps_domestic_16'] = $this->config->get('shipping_usps_domestic_16'); + } + + if (isset($this->request->post['shipping_usps_domestic_17'])) { + $data['shipping_usps_domestic_17'] = $this->request->post['shipping_usps_domestic_17']; + } else { + $data['shipping_usps_domestic_17'] = $this->config->get('shipping_usps_domestic_17'); + } + + if (isset($this->request->post['shipping_usps_domestic_18'])) { + $data['shipping_usps_domestic_18'] = $this->request->post['shipping_usps_domestic_18']; + } else { + $data['shipping_usps_domestic_18'] = $this->config->get('shipping_usps_domestic_18'); + } + + if (isset($this->request->post['shipping_usps_domestic_19'])) { + $data['shipping_usps_domestic_19'] = $this->request->post['shipping_usps_domestic_19']; + } else { + $data['shipping_usps_domestic_19'] = $this->config->get('shipping_usps_domestic_19'); + } + + if (isset($this->request->post['shipping_usps_domestic_22'])) { + $data['shipping_usps_domestic_22'] = $this->request->post['shipping_usps_domestic_22']; + } else { + $data['shipping_usps_domestic_22'] = $this->config->get('shipping_usps_domestic_22'); + } + + if (isset($this->request->post['shipping_usps_domestic_23'])) { + $data['shipping_usps_domestic_23'] = $this->request->post['shipping_usps_domestic_23']; + } else { + $data['shipping_usps_domestic_23'] = $this->config->get('shipping_usps_domestic_23'); + } + + if (isset($this->request->post['shipping_usps_domestic_25'])) { + $data['shipping_usps_domestic_25'] = $this->request->post['shipping_usps_domestic_25']; + } else { + $data['shipping_usps_domestic_25'] = $this->config->get('shipping_usps_domestic_25'); + } + + if (isset($this->request->post['shipping_usps_domestic_27'])) { + $data['shipping_usps_domestic_27'] = $this->request->post['shipping_usps_domestic_27']; + } else { + $data['shipping_usps_domestic_27'] = $this->config->get('shipping_usps_domestic_27'); + } + + if (isset($this->request->post['shipping_usps_domestic_28'])) { + $data['shipping_usps_domestic_28'] = $this->request->post['shipping_usps_domestic_28']; + } else { + $data['shipping_usps_domestic_28'] = $this->config->get('shipping_usps_domestic_28'); + } + + if (isset($this->request->post['shipping_usps_international_1'])) { + $data['shipping_usps_international_1'] = $this->request->post['shipping_usps_international_1']; + } else { + $data['shipping_usps_international_1'] = $this->config->get('shipping_usps_international_1'); + } + + if (isset($this->request->post['shipping_usps_international_2'])) { + $data['shipping_usps_international_2'] = $this->request->post['shipping_usps_international_2']; + } else { + $data['shipping_usps_international_2'] = $this->config->get('shipping_usps_international_2'); + } + + if (isset($this->request->post['shipping_usps_international_4'])) { + $data['shipping_usps_international_4'] = $this->request->post['shipping_usps_international_4']; + } else { + $data['shipping_usps_international_4'] = $this->config->get('shipping_usps_international_4'); + } + + if (isset($this->request->post['shipping_usps_international_5'])) { + $data['shipping_usps_international_5'] = $this->request->post['shipping_usps_international_5']; + } else { + $data['shipping_usps_international_5'] = $this->config->get('shipping_usps_international_5'); + } + + if (isset($this->request->post['shipping_usps_international_6'])) { + $data['shipping_usps_international_6'] = $this->request->post['shipping_usps_international_6']; + } else { + $data['shipping_usps_international_6'] = $this->config->get('shipping_usps_international_6'); + } + + if (isset($this->request->post['shipping_usps_international_7'])) { + $data['shipping_usps_international_7'] = $this->request->post['shipping_usps_international_7']; + } else { + $data['shipping_usps_international_7'] = $this->config->get('shipping_usps_international_7'); + } + + if (isset($this->request->post['shipping_usps_international_8'])) { + $data['shipping_usps_international_8'] = $this->request->post['shipping_usps_international_8']; + } else { + $data['shipping_usps_international_8'] = $this->config->get('shipping_usps_international_8'); + } + + if (isset($this->request->post['shipping_usps_international_9'])) { + $data['shipping_usps_international_9'] = $this->request->post['shipping_usps_international_9']; + } else { + $data['shipping_usps_international_9'] = $this->config->get('shipping_usps_international_9'); + } + + if (isset($this->request->post['shipping_usps_international_10'])) { + $data['shipping_usps_international_10'] = $this->request->post['shipping_usps_international_10']; + } else { + $data['shipping_usps_international_10'] = $this->config->get('shipping_usps_international_10'); + } + + if (isset($this->request->post['shipping_usps_international_11'])) { + $data['shipping_usps_international_11'] = $this->request->post['shipping_usps_international_11']; + } else { + $data['shipping_usps_international_11'] = $this->config->get('shipping_usps_international_11'); + } + + if (isset($this->request->post['shipping_usps_international_12'])) { + $data['shipping_usps_international_12'] = $this->request->post['shipping_usps_international_12']; + } else { + $data['shipping_usps_international_12'] = $this->config->get('shipping_usps_international_12'); + } + + if (isset($this->request->post['shipping_usps_international_13'])) { + $data['shipping_usps_international_13'] = $this->request->post['shipping_usps_international_13']; + } else { + $data['shipping_usps_international_13'] = $this->config->get('shipping_usps_international_13'); + } + + if (isset($this->request->post['shipping_usps_international_14'])) { + $data['shipping_usps_international_14'] = $this->request->post['shipping_usps_international_14']; + } else { + $data['shipping_usps_international_14'] = $this->config->get('shipping_usps_international_14'); + } + + if (isset($this->request->post['shipping_usps_international_15'])) { + $data['shipping_usps_international_15'] = $this->request->post['shipping_usps_international_15']; + } else { + $data['shipping_usps_international_15'] = $this->config->get('shipping_usps_international_15'); + } + + if (isset($this->request->post['shipping_usps_international_16'])) { + $data['shipping_usps_international_16'] = $this->request->post['shipping_usps_international_16']; + } else { + $data['shipping_usps_international_16'] = $this->config->get('shipping_usps_international_16'); + } + + if (isset($this->request->post['shipping_usps_international_21'])) { + $data['shipping_usps_international_21'] = $this->request->post['shipping_usps_international_21']; + } else { + $data['shipping_usps_international_21'] = $this->config->get('shipping_usps_international_21'); + } + + if (isset($this->request->post['shipping_usps_size'])) { + $data['shipping_usps_size'] = $this->request->post['shipping_usps_size']; + } else { + $data['shipping_usps_size'] = $this->config->get('shipping_usps_size'); + } + + $data['sizes'] = array(); + + $data['sizes'][] = array( + 'text' => $this->language->get('text_regular'), + 'value' => 'REGULAR' + ); + + $data['sizes'][] = array( + 'text' => $this->language->get('text_large'), + 'value' => 'LARGE' + ); + + if (isset($this->request->post['shipping_usps_container'])) { + $data['shipping_usps_container'] = $this->request->post['shipping_usps_container']; + } else { + $data['shipping_usps_container'] = $this->config->get('shipping_usps_container'); + } + + $data['containers'] = array(); + + $data['containers'][] = array( + 'text' => $this->language->get('text_rectangular'), + 'value' => 'RECTANGULAR' + ); + + $data['containers'][] = array( + 'text' => $this->language->get('text_non_rectangular'), + 'value' => 'NONRECTANGULAR' + ); + + $data['containers'][] = array( + 'text' => $this->language->get('text_variable'), + 'value' => 'VARIABLE' + ); + + if (isset($this->request->post['shipping_usps_machinable'])) { + $data['shipping_usps_machinable'] = $this->request->post['shipping_usps_machinable']; + } else { + $data['shipping_usps_machinable'] = $this->config->get('shipping_usps_machinable'); + } + + if (isset($this->request->post['shipping_usps_length'])) { + $data['shipping_usps_length'] = $this->request->post['shipping_usps_length']; + } else { + $data['shipping_usps_length'] = $this->config->get('shipping_usps_length'); + } + + if (isset($this->request->post['shipping_usps_width'])) { + $data['shipping_usps_width'] = $this->request->post['shipping_usps_width']; + } else { + $data['shipping_usps_width'] = $this->config->get('shipping_usps_width'); + } + + if (isset($this->request->post['shipping_usps_height'])) { + $data['shipping_usps_height'] = $this->request->post['shipping_usps_height']; + } else { + $data['shipping_usps_height'] = $this->config->get('shipping_usps_height'); + } + + if (isset($this->request->post['shipping_usps_display_time'])) { + $data['shipping_usps_display_time'] = $this->request->post['shipping_usps_display_time']; + } else { + $data['shipping_usps_display_time'] = $this->config->get('shipping_usps_display_time'); + } + + if (isset($this->request->post['shipping_usps_display_weight'])) { + $data['shipping_usps_display_weight'] = $this->request->post['shipping_usps_display_weight']; + } else { + $data['shipping_usps_display_weight'] = $this->config->get('shipping_usps_display_weight'); + } + + if (isset($this->request->post['shipping_usps_weight_class_id'])) { + $data['shipping_usps_weight_class_id'] = $this->request->post['shipping_usps_weight_class_id']; + } else { + $data['shipping_usps_weight_class_id'] = $this->config->get('shipping_usps_weight_class_id'); + } + + $this->load->model('localisation/weight_class'); + + $data['weight_classes'] = $this->model_localisation_weight_class->getWeightClasses(); + + if (isset($this->request->post['shipping_usps_tax_class_id'])) { + $data['shipping_usps_tax_class_id'] = $this->request->post['shipping_usps_tax_class_id']; + } else { + $data['shipping_usps_tax_class_id'] = $this->config->get('shipping_usps_tax_class_id'); + } + + $this->load->model('localisation/tax_class'); + + $data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses(); + + if (isset($this->request->post['shipping_usps_geo_zone_id'])) { + $data['shipping_usps_geo_zone_id'] = $this->request->post['shipping_usps_geo_zone_id']; + } else { + $data['shipping_usps_geo_zone_id'] = $this->config->get('shipping_usps_geo_zone_id'); + } + + $this->load->model('localisation/geo_zone'); + + $data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones(); + + if (isset($this->request->post['shipping_usps_debug'])) { + $data['shipping_usps_debug'] = $this->request->post['shipping_usps_debug']; + } else { + $data['shipping_usps_debug'] = $this->config->get('shipping_usps_debug'); + } + + if (isset($this->request->post['shipping_usps_status'])) { + $data['shipping_usps_status'] = $this->request->post['shipping_usps_status']; + } else { + $data['shipping_usps_status'] = $this->config->get('shipping_usps_status'); + } + + if (isset($this->request->post['shipping_usps_sort_order'])) { + $data['shipping_usps_sort_order'] = $this->request->post['shipping_usps_sort_order']; + } else { + $data['shipping_usps_sort_order'] = $this->config->get('shipping_usps_sort_order'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/shipping/usps', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/shipping/usps')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + if (!$this->request->post['shipping_usps_user_id']) { + $this->error['user_id'] = $this->language->get('error_user_id'); + } + + if (!$this->request->post['shipping_usps_postcode']) { + $this->error['postcode'] = $this->language->get('error_postcode'); + } + + if (!$this->request->post['shipping_usps_width']) { + $this->error['dimension'] = $this->language->get('error_width'); + } + + if (!$this->request->post['shipping_usps_height']) { + $this->error['dimension'] = $this->language->get('error_height'); + } + + if (!$this->request->post['shipping_usps_length']) { + $this->error['dimension'] = $this->language->get('error_length'); + } + + return !$this->error; + } +} diff --git a/public/admin/controller/extension/shipping/weight.php b/public/admin/controller/extension/shipping/weight.php new file mode 100644 index 0000000..2fbda41 --- /dev/null +++ b/public/admin/controller/extension/shipping/weight.php @@ -0,0 +1,103 @@ +<?php +class ControllerExtensionShippingWeight extends Controller { + private $error = array(); + + public function index() { + $this->load->language('extension/shipping/weight'); + + $this->document->setTitle($this->language->get('heading_title')); + + $this->load->model('setting/setting'); + + if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { + $this->model_setting_setting->editSetting('shipping_weight', $this->request->post); + + $this->session->data['success'] = $this->language->get('text_success'); + + $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true)); + } + + if (isset($this->error['warning'])) { + $data['error_warning'] = $this->error['warning']; + } else { + $data['error_warning'] = ''; + } + + $data['breadcrumbs'] = array(); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_home'), + 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('text_extension'), + 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true) + ); + + $data['breadcrumbs'][] = array( + 'text' => $this->language->get('heading_title'), + 'href' => $this->url->link('extension/shipping/weight', 'user_token=' . $this->session->data['user_token'], true) + ); + + $data['action'] = $this->url->link('extension/shipping/weight', 'user_token=' . $this->session->data['user_token'], true); + + $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=shipping', true); + + $this->load->model('localisation/geo_zone'); + + $geo_zones = $this->model_localisation_geo_zone->getGeoZones(); + + foreach ($geo_zones as $geo_zone) { + if (isset($this->request->post['shipping_weight_' . $geo_zone['geo_zone_id'] . '_rate'])) { + $data['shipping_weight_geo_zone_rate'][$geo_zone['geo_zone_id']] = $this->request->post['shipping_weight_' . $geo_zone['geo_zone_id'] . '_rate']; + } else { + $data['shipping_weight_geo_zone_rate'][$geo_zone['geo_zone_id']] = $this->config->get('shipping_weight_' . $geo_zone['geo_zone_id'] . '_rate'); + } + + if (isset($this->request->post['shipping_weight_' . $geo_zone['geo_zone_id'] . '_status'])) { + $data['shipping_weight_geo_zone_status'][$geo_zone['geo_zone_id']] = $this->request->post['shipping_weight_' . $geo_zone['geo_zone_id'] . '_status']; + } else { + $data['shipping_weight_geo_zone_status'][$geo_zone['geo_zone_id']] = $this->config->get('shipping_weight_' . $geo_zone['geo_zone_id'] . '_status'); + } + } + + $data['geo_zones'] = $geo_zones; + + if (isset($this->request->post['shipping_weight_tax_class_id'])) { + $data['shipping_weight_tax_class_id'] = $this->request->post['shipping_weight_tax_class_id']; + } else { + $data['shipping_weight_tax_class_id'] = $this->config->get('shipping_weight_tax_class_id'); + } + + $this->load->model('localisation/tax_class'); + + $data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses(); + + if (isset($this->request->post['shipping_weight_status'])) { + $data['shipping_weight_status'] = $this->request->post['shipping_weight_status']; + } else { + $data['shipping_weight_status'] = $this->config->get('shipping_weight_status'); + } + + if (isset($this->request->post['shipping_weight_sort_order'])) { + $data['shipping_weight_sort_order'] = $this->request->post['shipping_weight_sort_order']; + } else { + $data['shipping_weight_sort_order'] = $this->config->get('shipping_weight_sort_order'); + } + + $data['header'] = $this->load->controller('common/header'); + $data['column_left'] = $this->load->controller('common/column_left'); + $data['footer'] = $this->load->controller('common/footer'); + + $this->response->setOutput($this->load->view('extension/shipping/weight', $data)); + } + + protected function validate() { + if (!$this->user->hasPermission('modify', 'extension/shipping/weight')) { + $this->error['warning'] = $this->language->get('error_permission'); + } + + return !$this->error; + } +}
\ No newline at end of file |