nochex.php (5714B)
1 <?php 2 class ControllerExtensionPaymentNOCHEX extends Controller { 3 private $error = array(); 4 5 public function index() { 6 $this->load->language('extension/payment/nochex'); 7 8 $this->document->setTitle($this->language->get('heading_title')); 9 10 $this->load->model('setting/setting'); 11 12 if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { 13 $this->model_setting_setting->editSetting('payment_nochex', $this->request->post); 14 15 $this->session->data['success'] = $this->language->get('text_success'); 16 17 $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true)); 18 } 19 20 if (isset($this->error['warning'])) { 21 $data['error_warning'] = $this->error['warning']; 22 } else { 23 $data['error_warning'] = ''; 24 } 25 26 if (isset($this->error['email'])) { 27 $data['error_email'] = $this->error['email']; 28 } else { 29 $data['error_email'] = ''; 30 } 31 32 if (isset($this->error['merchant'])) { 33 $data['error_merchant'] = $this->error['merchant']; 34 } else { 35 $data['error_merchant'] = ''; 36 } 37 38 $data['breadcrumbs'] = array(); 39 40 $data['breadcrumbs'][] = array( 41 'text' => $this->language->get('text_home'), 42 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) 43 ); 44 45 $data['breadcrumbs'][] = array( 46 'text' => $this->language->get('text_extension'), 47 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true) 48 ); 49 50 $data['breadcrumbs'][] = array( 51 'text' => $this->language->get('heading_title'), 52 'href' => $this->url->link('extension/payment/nochex', 'user_token=' . $this->session->data['user_token'], true) 53 ); 54 55 $data['action'] = $this->url->link('extension/payment/nochex', 'user_token=' . $this->session->data['user_token'], true); 56 57 $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true); 58 59 if (isset($this->request->post['payment_nochex_email'])) { 60 $data['payment_nochex_email'] = $this->request->post['payment_nochex_email']; 61 } else { 62 $data['payment_nochex_email'] = $this->config->get('payment_nochex_email'); 63 } 64 65 if (isset($this->request->post['payment_nochex_account'])) { 66 $data['payment_nochex_account'] = $this->request->post['payment_nochex_account']; 67 } else { 68 $data['payment_nochex_account'] = $this->config->get('payment_nochex_account'); 69 } 70 71 if (isset($this->request->post['payment_nochex_merchant'])) { 72 $data['payment_nochex_merchant'] = $this->request->post['payment_nochex_merchant']; 73 } else { 74 $data['payment_nochex_merchant'] = $this->config->get('payment_nochex_merchant'); 75 } 76 77 if (isset($this->request->post['payment_nochex_template'])) { 78 $data['payment_nochex_template'] = $this->request->post['payment_nochex_template']; 79 } else { 80 $data['payment_nochex_template'] = $this->config->get('payment_nochex_template'); 81 } 82 83 if (isset($this->request->post['payment_nochex_test'])) { 84 $data['payment_nochex_test'] = $this->request->post['payment_nochex_test']; 85 } else { 86 $data['payment_nochex_test'] = $this->config->get('payment_nochex_test'); 87 } 88 89 if (isset($this->request->post['payment_nochex_total'])) { 90 $data['payment_nochex_total'] = $this->request->post['payment_nochex_total']; 91 } else { 92 $data['payment_nochex_total'] = $this->config->get('payment_nochex_total'); 93 } 94 95 if (isset($this->request->post['payment_nochex_order_status_id'])) { 96 $data['payment_nochex_order_status_id'] = $this->request->post['payment_nochex_order_status_id']; 97 } else { 98 $data['payment_nochex_order_status_id'] = $this->config->get('payment_nochex_order_status_id'); 99 } 100 101 $this->load->model('localisation/order_status'); 102 103 $data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses(); 104 105 if (isset($this->request->post['payment_nochex_geo_zone_id'])) { 106 $data['payment_nochex_geo_zone_id'] = $this->request->post['payment_nochex_geo_zone_id']; 107 } else { 108 $data['payment_nochex_geo_zone_id'] = $this->config->get('payment_nochex_geo_zone_id'); 109 } 110 111 $this->load->model('localisation/geo_zone'); 112 113 $data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones(); 114 115 if (isset($this->request->post['payment_nochex_status'])) { 116 $data['payment_nochex_status'] = $this->request->post['payment_nochex_status']; 117 } else { 118 $data['payment_nochex_status'] = $this->config->get('payment_nochex_status'); 119 } 120 121 if (isset($this->request->post['payment_nochex_sort_order'])) { 122 $data['payment_nochex_sort_order'] = $this->request->post['payment_nochex_sort_order']; 123 } else { 124 $data['payment_nochex_sort_order'] = $this->config->get('payment_nochex_sort_order'); 125 } 126 127 $data['header'] = $this->load->controller('common/header'); 128 $data['column_left'] = $this->load->controller('common/column_left'); 129 $data['footer'] = $this->load->controller('common/footer'); 130 131 $this->response->setOutput($this->load->view('extension/payment/nochex', $data)); 132 } 133 134 protected function validate() { 135 if (!$this->user->hasPermission('modify', 'extension/payment/nochex')) { 136 $this->error['warning'] = $this->language->get('error_permission'); 137 } 138 139 if (!$this->request->post['payment_nochex_email']) { 140 $this->error['email'] = $this->language->get('error_email'); 141 } 142 143 if (!$this->request->post['payment_nochex_merchant']) { 144 $this->error['merchant'] = $this->language->get('error_merchant'); 145 } 146 147 return !$this->error; 148 } 149 }