PageRenderTime 69ms CodeModel.GetById 10ms RepoModel.GetById 1ms app.codeStats 0ms

/admin/controller/sale/order.php

https://bitbucket.org/jjasko/opencart_serbian
PHP | 2086 lines | 1627 code | 452 blank | 7 comment | 373 complexity | 1c1ee3b00306f75f26ad0d971d8e4b54 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. class ControllerSaleOrder extends Controller {
  3. private $error = array();
  4. public function index() {
  5. $this->load->language('sale/order');
  6. $this->document->setTitle($this->language->get('heading_title'));
  7. $this->load->model('sale/order');
  8. $this->getList();
  9. }
  10. public function insert() {
  11. $this->load->language('sale/order');
  12. $this->document->setTitle($this->language->get('heading_title'));
  13. $this->load->model('sale/order');
  14. if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
  15. $this->model_sale_order->addOrder($this->request->post);
  16. $this->session->data['success'] = $this->language->get('text_success');
  17. $url = '';
  18. if (isset($this->request->get['filter_order_id'])) {
  19. $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
  20. }
  21. if (isset($this->request->get['filter_customer'])) {
  22. $url .= '&filter_customer=' . $this->request->get['filter_customer'];
  23. }
  24. if (isset($this->request->get['filter_order_status_id'])) {
  25. $url .= '&filter_order_status_id=' . $this->request->get['filter_order_status_id'];
  26. }
  27. if (isset($this->request->get['filter_total'])) {
  28. $url .= '&filter_total=' . $this->request->get['filter_total'];
  29. }
  30. if (isset($this->request->get['filter_date_added'])) {
  31. $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
  32. }
  33. if (isset($this->request->get['filter_date_modified'])) {
  34. $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified'];
  35. }
  36. if (isset($this->request->get['sort'])) {
  37. $url .= '&sort=' . $this->request->get['sort'];
  38. }
  39. if (isset($this->request->get['order'])) {
  40. $url .= '&order=' . $this->request->get['order'];
  41. }
  42. if (isset($this->request->get['page'])) {
  43. $url .= '&page=' . $this->request->get['page'];
  44. }
  45. $this->redirect($this->url->link('sale/return', 'token=' . $this->session->data['token'] . $url, 'SSL'));
  46. }
  47. $this->getForm();
  48. }
  49. public function update() {
  50. $this->load->language('sale/order');
  51. $this->document->setTitle($this->language->get('heading_title'));
  52. $this->load->model('sale/order');
  53. if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
  54. $this->model_sale_order->editOrder($this->request->get['order_id'], $this->request->post);
  55. $this->session->data['success'] = $this->language->get('text_success');
  56. $url = '';
  57. if (isset($this->request->get['filter_order_id'])) {
  58. $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
  59. }
  60. if (isset($this->request->get['filter_customer'])) {
  61. $url .= '&filter_customer=' . $this->request->get['filter_customer'];
  62. }
  63. if (isset($this->request->get['filter_order_status_id'])) {
  64. $url .= '&filter_order_status_id=' . $this->request->get['filter_order_status_id'];
  65. }
  66. if (isset($this->request->get['filter_total'])) {
  67. $url .= '&filter_total=' . $this->request->get['filter_total'];
  68. }
  69. if (isset($this->request->get['filter_date_added'])) {
  70. $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
  71. }
  72. if (isset($this->request->get['filter_date_modified'])) {
  73. $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified'];
  74. }
  75. if (isset($this->request->get['sort'])) {
  76. $url .= '&sort=' . $this->request->get['sort'];
  77. }
  78. if (isset($this->request->get['order'])) {
  79. $url .= '&order=' . $this->request->get['order'];
  80. }
  81. if (isset($this->request->get['page'])) {
  82. $url .= '&page=' . $this->request->get['page'];
  83. }
  84. $this->redirect($this->url->link('sale/return', 'token=' . $this->session->data['token'] . $url, 'SSL'));
  85. }
  86. $this->getForm();
  87. }
  88. public function delete() {
  89. $this->load->language('sale/order');
  90. $this->document->setTitle($this->language->get('heading_title'));
  91. $this->load->model('sale/order');
  92. if (isset($this->request->post['selected']) && ($this->validateDelete())) {
  93. foreach ($this->request->post['selected'] as $order_id) {
  94. $this->model_sale_order->deleteOrder($order_id);
  95. }
  96. $this->session->data['success'] = $this->language->get('text_success');
  97. $url = '';
  98. if (isset($this->request->get['filter_order_id'])) {
  99. $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
  100. }
  101. if (isset($this->request->get['filter_customer'])) {
  102. $url .= '&filter_customer=' . $this->request->get['filter_customer'];
  103. }
  104. if (isset($this->request->get['filter_order_status_id'])) {
  105. $url .= '&filter_order_status_id=' . $this->request->get['filter_order_status_id'];
  106. }
  107. if (isset($this->request->get['filter_total'])) {
  108. $url .= '&filter_total=' . $this->request->get['filter_total'];
  109. }
  110. if (isset($this->request->get['filter_date_added'])) {
  111. $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
  112. }
  113. if (isset($this->request->get['filter_date_modified'])) {
  114. $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified'];
  115. }
  116. if (isset($this->request->get['sort'])) {
  117. $url .= '&sort=' . $this->request->get['sort'];
  118. }
  119. if (isset($this->request->get['order'])) {
  120. $url .= '&order=' . $this->request->get['order'];
  121. }
  122. if (isset($this->request->get['page'])) {
  123. $url .= '&page=' . $this->request->get['page'];
  124. }
  125. $this->redirect($this->url->link('sale/order', 'token=' . $this->session->data['token'] . $url, 'SSL'));
  126. }
  127. $this->getList();
  128. }
  129. private function getList() {
  130. if (isset($this->request->get['filter_order_id'])) {
  131. $filter_order_id = $this->request->get['filter_order_id'];
  132. } else {
  133. $filter_order_id = null;
  134. }
  135. if (isset($this->request->get['filter_customer'])) {
  136. $filter_customer = $this->request->get['filter_customer'];
  137. } else {
  138. $filter_customer = null;
  139. }
  140. if (isset($this->request->get['filter_order_status_id'])) {
  141. $filter_order_status_id = $this->request->get['filter_order_status_id'];
  142. } else {
  143. $filter_order_status_id = null;
  144. }
  145. if (isset($this->request->get['filter_total'])) {
  146. $filter_total = $this->request->get['filter_total'];
  147. } else {
  148. $filter_total = null;
  149. }
  150. if (isset($this->request->get['filter_date_added'])) {
  151. $filter_date_added = $this->request->get['filter_date_added'];
  152. } else {
  153. $filter_date_added = null;
  154. }
  155. if (isset($this->request->get['filter_date_modified'])) {
  156. $filter_date_modified = $this->request->get['filter_date_modified'];
  157. } else {
  158. $filter_date_modified = null;
  159. }
  160. if (isset($this->request->get['sort'])) {
  161. $sort = $this->request->get['sort'];
  162. } else {
  163. $sort = 'o.order_id';
  164. }
  165. if (isset($this->request->get['order'])) {
  166. $order = $this->request->get['order'];
  167. } else {
  168. $order = 'DESC';
  169. }
  170. if (isset($this->request->get['page'])) {
  171. $page = $this->request->get['page'];
  172. } else {
  173. $page = 1;
  174. }
  175. $url = '';
  176. if (isset($this->request->get['filter_order_id'])) {
  177. $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
  178. }
  179. if (isset($this->request->get['filter_customer'])) {
  180. $url .= '&filter_customer=' . $this->request->get['filter_customer'];
  181. }
  182. if (isset($this->request->get['filter_order_status_id'])) {
  183. $url .= '&filter_order_status_id=' . $this->request->get['filter_order_status_id'];
  184. }
  185. if (isset($this->request->get['filter_total'])) {
  186. $url .= '&filter_total=' . $this->request->get['filter_total'];
  187. }
  188. if (isset($this->request->get['filter_date_added'])) {
  189. $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
  190. }
  191. if (isset($this->request->get['filter_date_modified'])) {
  192. $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified'];
  193. }
  194. if (isset($this->request->get['sort'])) {
  195. $url .= '&sort=' . $this->request->get['sort'];
  196. }
  197. if (isset($this->request->get['order'])) {
  198. $url .= '&order=' . $this->request->get['order'];
  199. }
  200. if (isset($this->request->get['page'])) {
  201. $url .= '&page=' . $this->request->get['page'];
  202. }
  203. $this->data['breadcrumbs'] = array();
  204. $this->data['breadcrumbs'][] = array(
  205. 'text' => $this->language->get('text_home'),
  206. 'href' => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
  207. 'separator' => false
  208. );
  209. $this->data['breadcrumbs'][] = array(
  210. 'text' => $this->language->get('heading_title'),
  211. 'href' => $this->url->link('sale/order', 'token=' . $this->session->data['token'] . $url, 'SSL'),
  212. 'separator' => ' :: '
  213. );
  214. $this->data['invoice'] = $this->url->link('sale/order/invoice', 'token=' . $this->session->data['token'], 'SSL');
  215. $this->data['delete'] = $this->url->link('sale/order/delete', 'token=' . $this->session->data['token'] . $url, 'SSL');
  216. $this->data['orders'] = array();
  217. $data = array(
  218. 'filter_order_id' => $filter_order_id,
  219. 'filter_customer' => $filter_customer,
  220. 'filter_order_status_id' => $filter_order_status_id,
  221. 'filter_total' => $filter_total,
  222. 'filter_date_added' => $filter_date_added,
  223. 'filter_date_modified' => $filter_date_modified,
  224. 'sort' => $sort,
  225. 'order' => $order,
  226. 'start' => ($page - 1) * $this->config->get('config_admin_limit'),
  227. 'limit' => $this->config->get('config_admin_limit')
  228. );
  229. $order_total = $this->model_sale_order->getTotalOrders($data);
  230. $results = $this->model_sale_order->getOrders($data);
  231. foreach ($results as $result) {
  232. $action = array();
  233. $action[] = array(
  234. 'text' => $this->language->get('text_view'),
  235. 'href' => $this->url->link('sale/order/info', 'token=' . $this->session->data['token'] . '&order_id=' . $result['order_id'] . $url, 'SSL')
  236. );
  237. /*
  238. Commented out until I can finish the order editing system.
  239. $action[] = array(
  240. 'text' => $this->language->get('text_edit'),
  241. 'href' => $this->url->link('sale/order/update', 'token=' . $this->session->data['token'] . '&order_id=' . $result['order_id'] . $url, 'SSL')
  242. );
  243. */
  244. $this->data['orders'][] = array(
  245. 'order_id' => $result['order_id'],
  246. 'customer' => $result['customer'],
  247. 'status' => $result['status'],
  248. 'total' => $this->currency->format($result['total'], $result['currency_code'], $result['currency_value']),
  249. 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
  250. 'date_modified' => date($this->language->get('date_format_short'), strtotime($result['date_modified'])),
  251. 'selected' => isset($this->request->post['selected']) && in_array($result['order_id'], $this->request->post['selected']),
  252. 'action' => $action
  253. );
  254. }
  255. $this->data['heading_title'] = $this->language->get('heading_title');
  256. $this->data['text_no_results'] = $this->language->get('text_no_results');
  257. $this->data['text_abandoned_orders'] = $this->language->get('text_abandoned_orders');
  258. $this->data['column_order_id'] = $this->language->get('column_order_id');
  259. $this->data['column_customer'] = $this->language->get('column_customer');
  260. $this->data['column_status'] = $this->language->get('column_status');
  261. $this->data['column_total'] = $this->language->get('column_total');
  262. $this->data['column_date_added'] = $this->language->get('column_date_added');
  263. $this->data['column_date_modified'] = $this->language->get('column_date_modified');
  264. $this->data['column_action'] = $this->language->get('column_action');
  265. $this->data['button_invoice'] = $this->language->get('button_invoice');
  266. $this->data['button_delete'] = $this->language->get('button_delete');
  267. $this->data['button_filter'] = $this->language->get('button_filter');
  268. $this->data['token'] = $this->session->data['token'];
  269. if (isset($this->error['warning'])) {
  270. $this->data['error_warning'] = $this->error['warning'];
  271. } else {
  272. $this->data['error_warning'] = '';
  273. }
  274. if (isset($this->session->data['success'])) {
  275. $this->data['success'] = $this->session->data['success'];
  276. unset($this->session->data['success']);
  277. } else {
  278. $this->data['success'] = '';
  279. }
  280. $url = '';
  281. if (isset($this->request->get['filter_order_id'])) {
  282. $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
  283. }
  284. if (isset($this->request->get['filter_customer'])) {
  285. $url .= '&filter_customer=' . $this->request->get['filter_customer'];
  286. }
  287. if (isset($this->request->get['filter_order_status_id'])) {
  288. $url .= '&filter_order_status_id=' . $this->request->get['filter_order_status_id'];
  289. }
  290. if (isset($this->request->get['filter_total'])) {
  291. $url .= '&filter_total=' . $this->request->get['filter_total'];
  292. }
  293. if (isset($this->request->get['filter_date_added'])) {
  294. $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
  295. }
  296. if (isset($this->request->get['filter_date_modified'])) {
  297. $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified'];
  298. }
  299. if ($order == 'ASC') {
  300. $url .= '&order=' . 'DESC';
  301. } else {
  302. $url .= '&order=' . 'ASC';
  303. }
  304. if (isset($this->request->get['page'])) {
  305. $url .= '&page=' . $this->request->get['page'];
  306. }
  307. $this->data['sort_order'] = $this->url->link('sale/order', 'token=' . $this->session->data['token'] . '&sort=o.order_id' . $url, 'SSL');
  308. $this->data['sort_customer'] = $this->url->link('sale/order', 'token=' . $this->session->data['token'] . '&sort=customer' . $url, 'SSL');
  309. $this->data['sort_status'] = $this->url->link('sale/order', 'token=' . $this->session->data['token'] . '&sort=status' . $url, 'SSL');
  310. $this->data['sort_total'] = $this->url->link('sale/order', 'token=' . $this->session->data['token'] . '&sort=o.total' . $url, 'SSL');
  311. $this->data['sort_date_added'] = $this->url->link('sale/order', 'token=' . $this->session->data['token'] . '&sort=o.date_added' . $url, 'SSL');
  312. $this->data['sort_date_modified'] = $this->url->link('sale/order', 'token=' . $this->session->data['token'] . '&sort=o.date_modified' . $url, 'SSL');
  313. $url = '';
  314. if (isset($this->request->get['filter_order_id'])) {
  315. $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
  316. }
  317. if (isset($this->request->get['filter_customer'])) {
  318. $url .= '&filter_customer=' . $this->request->get['filter_customer'];
  319. }
  320. if (isset($this->request->get['filter_order_status_id'])) {
  321. $url .= '&filter_order_status_id=' . $this->request->get['filter_order_status_id'];
  322. }
  323. if (isset($this->request->get['filter_total'])) {
  324. $url .= '&filter_total=' . $this->request->get['filter_total'];
  325. }
  326. if (isset($this->request->get['filter_date_added'])) {
  327. $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
  328. }
  329. if (isset($this->request->get['filter_date_modified'])) {
  330. $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified'];
  331. }
  332. if (isset($this->request->get['sort'])) {
  333. $url .= '&sort=' . $this->request->get['sort'];
  334. }
  335. if (isset($this->request->get['order'])) {
  336. $url .= '&order=' . $this->request->get['order'];
  337. }
  338. $pagination = new Pagination();
  339. $pagination->total = $order_total;
  340. $pagination->page = $page;
  341. $pagination->limit = $this->config->get('config_admin_limit');
  342. $pagination->text = $this->language->get('text_pagination');
  343. $pagination->url = $this->url->link('sale/order', 'token=' . $this->session->data['token'] . $url . '&page={page}', 'SSL');
  344. $this->data['pagination'] = $pagination->render();
  345. $this->data['filter_order_id'] = $filter_order_id;
  346. $this->data['filter_customer'] = $filter_customer;
  347. $this->data['filter_order_status_id'] = $filter_order_status_id;
  348. $this->data['filter_total'] = $filter_total;
  349. $this->data['filter_date_added'] = $filter_date_added;
  350. $this->data['filter_date_modified'] = $filter_date_modified;
  351. $this->load->model('localisation/order_status');
  352. $this->data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
  353. $this->data['sort'] = $sort;
  354. $this->data['order'] = $order;
  355. $this->template = 'sale/order_list.tpl';
  356. $this->children = array(
  357. 'common/header',
  358. 'common/footer'
  359. );
  360. $this->response->setOutput($this->render());
  361. }
  362. public function getForm() {
  363. $this->data['heading_title'] = $this->language->get('heading_title');
  364. $this->data['text_default'] = $this->language->get('text_default');
  365. $this->data['text_select'] = $this->language->get('text_select');
  366. $this->data['text_none'] = $this->language->get('text_none');
  367. $this->data['text_wait'] = $this->language->get('text_wait');
  368. $this->data['entry_store'] = $this->language->get('entry_store');
  369. $this->data['entry_customer'] = $this->language->get('entry_customer');
  370. $this->data['entry_customer_group'] = $this->language->get('entry_customer_group');
  371. $this->data['entry_firstname'] = $this->language->get('entry_firstname');
  372. $this->data['entry_lastname'] = $this->language->get('entry_lastname');
  373. $this->data['entry_email'] = $this->language->get('entry_email');
  374. $this->data['entry_telephone'] = $this->language->get('entry_telephone');
  375. $this->data['entry_fax'] = $this->language->get('entry_fax');
  376. $this->data['entry_order_status'] = $this->language->get('entry_order_status');
  377. $this->data['entry_comment'] = $this->language->get('entry_comment');
  378. $this->data['entry_affiliate'] = $this->language->get('entry_affiliate');
  379. $this->data['entry_address'] = $this->language->get('entry_address');
  380. $this->data['entry_company'] = $this->language->get('entry_company');
  381. $this->data['entry_address_1'] = $this->language->get('entry_address_1');
  382. $this->data['entry_address_2'] = $this->language->get('entry_address_2');
  383. $this->data['entry_city'] = $this->language->get('entry_city');
  384. $this->data['entry_postcode'] = $this->language->get('entry_postcode');
  385. $this->data['entry_zone'] = $this->language->get('entry_zone');
  386. $this->data['entry_zone_code'] = $this->language->get('entry_zone_code');
  387. $this->data['entry_country'] = $this->language->get('entry_country');
  388. $this->data['entry_product'] = $this->language->get('entry_product');
  389. $this->data['entry_option'] = $this->language->get('entry_option');
  390. $this->data['entry_quantity'] = $this->language->get('entry_quantity');
  391. $this->data['entry_shipping'] = $this->language->get('entry_shipping');
  392. $this->data['entry_payment'] = $this->language->get('entry_payment');
  393. $this->data['entry_voucher'] = $this->language->get('entry_voucher');
  394. $this->data['entry_reward'] = $this->language->get('entry_reward');
  395. $this->data['column_product'] = $this->language->get('column_product');
  396. $this->data['column_model'] = $this->language->get('column_model');
  397. $this->data['column_quantity'] = $this->language->get('column_quantity');
  398. $this->data['column_price'] = $this->language->get('column_price');
  399. $this->data['column_total'] = $this->language->get('column_total');
  400. $this->data['button_save'] = $this->language->get('button_save');
  401. $this->data['button_cancel'] = $this->language->get('button_cancel');
  402. $this->data['button_add_product'] = $this->language->get('button_add_product');
  403. $this->data['button_remove'] = $this->language->get('button_remove');
  404. $this->data['button_upload'] = $this->language->get('button_upload');
  405. $this->data['tab_order'] = $this->language->get('tab_order');
  406. $this->data['tab_payment'] = $this->language->get('tab_payment');
  407. $this->data['tab_shipping'] = $this->language->get('tab_shipping');
  408. $this->data['tab_product'] = $this->language->get('tab_product');
  409. $this->data['tab_total'] = $this->language->get('tab_total');
  410. $this->data['token'] = $this->session->data['token'];
  411. if (isset($this->error['warning'])) {
  412. $this->data['error_warning'] = $this->error['warning'];
  413. } else {
  414. $this->data['error_warning'] = '';
  415. }
  416. if (isset($this->error['firstname'])) {
  417. $this->data['error_firstname'] = $this->error['firstname'];
  418. } else {
  419. $this->data['error_firstname'] = '';
  420. }
  421. if (isset($this->error['lastname'])) {
  422. $this->data['error_lastname'] = $this->error['lastname'];
  423. } else {
  424. $this->data['error_lastname'] = '';
  425. }
  426. if (isset($this->error['email'])) {
  427. $this->data['error_email'] = $this->error['email'];
  428. } else {
  429. $this->data['error_email'] = '';
  430. }
  431. if (isset($this->error['telephone'])) {
  432. $this->data['error_telephone'] = $this->error['telephone'];
  433. } else {
  434. $this->data['error_telephone'] = '';
  435. }
  436. if (isset($this->error['shipping_firstname'])) {
  437. $this->data['error_shipping_firstname'] = $this->error['shipping_firstname'];
  438. } else {
  439. $this->data['error_shipping_firstname'] = '';
  440. }
  441. if (isset($this->error['shipping_lastname'])) {
  442. $this->data['error_shipping_lastname'] = $this->error['shipping_lastname'];
  443. } else {
  444. $this->data['error_shipping_lastname'] = '';
  445. }
  446. if (isset($this->error['shipping_address_1'])) {
  447. $this->data['error_shipping_address_1'] = $this->error['shipping_address_1'];
  448. } else {
  449. $this->data['error_shipping_address_1'] = '';
  450. }
  451. if (isset($this->error['shipping_city'])) {
  452. $this->data['error_shipping_city'] = $this->error['shipping_city'];
  453. } else {
  454. $this->data['error_shipping_city'] = '';
  455. }
  456. if (isset($this->error['shipping_postcode'])) {
  457. $this->data['error_shipping_postcode'] = $this->error['shipping_postcode'];
  458. } else {
  459. $this->data['error_shipping_postcode'] = '';
  460. }
  461. if (isset($this->error['shipping_country'])) {
  462. $this->data['error_shipping_country'] = $this->error['shipping_country'];
  463. } else {
  464. $this->data['error_shipping_country'] = '';
  465. }
  466. if (isset($this->error['shipping_zone'])) {
  467. $this->data['error_shipping_zone'] = $this->error['shipping_zone'];
  468. } else {
  469. $this->data['error_shipping_zone'] = '';
  470. }
  471. if (isset($this->error['payment_firstname'])) {
  472. $this->data['error_payment_firstname'] = $this->error['payment_firstname'];
  473. } else {
  474. $this->data['error_payment_firstname'] = '';
  475. }
  476. if (isset($this->error['payment_lastname'])) {
  477. $this->data['error_payment_lastname'] = $this->error['payment_lastname'];
  478. } else {
  479. $this->data['error_payment_lastname'] = '';
  480. }
  481. if (isset($this->error['payment_address_1'])) {
  482. $this->data['error_payment_address_1'] = $this->error['payment_address_1'];
  483. } else {
  484. $this->data['error_payment_address_1'] = '';
  485. }
  486. if (isset($this->error['payment_city'])) {
  487. $this->data['error_payment_city'] = $this->error['payment_city'];
  488. } else {
  489. $this->data['error_payment_city'] = '';
  490. }
  491. if (isset($this->error['payment_postcode'])) {
  492. $this->data['error_payment_postcode'] = $this->error['payment_postcode'];
  493. } else {
  494. $this->data['error_payment_postcode'] = '';
  495. }
  496. if (isset($this->error['payment_country'])) {
  497. $this->data['error_payment_country'] = $this->error['payment_country'];
  498. } else {
  499. $this->data['error_payment_country'] = '';
  500. }
  501. if (isset($this->error['payment_zone'])) {
  502. $this->data['error_payment_zone'] = $this->error['payment_zone'];
  503. } else {
  504. $this->data['error_payment_zone'] = '';
  505. }
  506. $url = '';
  507. if (isset($this->request->get['filter_order_id'])) {
  508. $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
  509. }
  510. if (isset($this->request->get['filter_customer'])) {
  511. $url .= '&filter_customer=' . $this->request->get['filter_customer'];
  512. }
  513. if (isset($this->request->get['filter_order_status_id'])) {
  514. $url .= '&filter_order_status_id=' . $this->request->get['filter_order_status_id'];
  515. }
  516. if (isset($this->request->get['filter_total'])) {
  517. $url .= '&filter_total=' . $this->request->get['filter_total'];
  518. }
  519. if (isset($this->request->get['filter_date_added'])) {
  520. $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
  521. }
  522. if (isset($this->request->get['filter_date_modified'])) {
  523. $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified'];
  524. }
  525. if (isset($this->request->get['sort'])) {
  526. $url .= '&sort=' . $this->request->get['sort'];
  527. }
  528. if (isset($this->request->get['order'])) {
  529. $url .= '&order=' . $this->request->get['order'];
  530. }
  531. if (isset($this->request->get['page'])) {
  532. $url .= '&page=' . $this->request->get['page'];
  533. }
  534. $this->data['breadcrumbs'] = array();
  535. $this->data['breadcrumbs'][] = array(
  536. 'text' => $this->language->get('text_home'),
  537. 'href' => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
  538. 'separator' => false
  539. );
  540. $this->data['breadcrumbs'][] = array(
  541. 'text' => $this->language->get('heading_title'),
  542. 'href' => $this->url->link('sale/order', 'token=' . $this->session->data['token'], 'SSL'),
  543. 'separator' => ' :: '
  544. );
  545. if (!isset($this->request->get['order_id'])) {
  546. $this->data['action'] = $this->url->link('sale/order/insert', 'token=' . $this->session->data['token'] . $url, 'SSL');
  547. } else {
  548. $this->data['action'] = $this->url->link('sale/order/update', 'token=' . $this->session->data['token'] . '&order_id=' . $this->request->get['order_id'] . $url, 'SSL');
  549. }
  550. $this->data['cancel'] = $this->url->link('sale/order', 'token=' . $this->session->data['token'] . $url, 'SSL');
  551. if (isset($this->request->get['order_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
  552. $order_info = $this->model_sale_order->getOrder($this->request->get['order_id']);
  553. }
  554. if (isset($this->request->post['store_id'])) {
  555. $this->data['store_id'] = $this->request->post['store_id'];
  556. } elseif (!empty($order_info)) {
  557. $this->data['store_id'] = $order_info['store_id'];
  558. } else {
  559. $this->data['store_id'] = '';
  560. }
  561. $this->load->model('setting/store');
  562. $this->data['stores'] = $this->model_setting_store->getStores();
  563. $this->data['store_url'] = HTTP_CATALOG;
  564. if (isset($this->request->post['customer_id'])) {
  565. $this->data['customer_id'] = $this->request->post['customer_id'];
  566. } elseif (!empty($order_info)) {
  567. $this->data['customer_id'] = $order_info['customer_id'];
  568. } else {
  569. $this->data['customer_id'] = '';
  570. }
  571. if (isset($this->request->post['customer'])) {
  572. $this->data['customer'] = $this->request->post['customer'];
  573. } elseif (!empty($order_info)) {
  574. $this->data['customer'] = $order_info['customer'];
  575. } else {
  576. $this->data['customer'] = '';
  577. }
  578. if (isset($this->request->post['firstname'])) {
  579. $this->data['firstname'] = $this->request->post['firstname'];
  580. } elseif (!empty($order_info)) {
  581. $this->data['firstname'] = $order_info['firstname'];
  582. } else {
  583. $this->data['firstname'] = '';
  584. }
  585. if (isset($this->request->post['lastname'])) {
  586. $this->data['lastname'] = $this->request->post['lastname'];
  587. } elseif (!empty($order_info)) {
  588. $this->data['lastname'] = $order_info['lastname'];
  589. } else {
  590. $this->data['lastname'] = '';
  591. }
  592. if (isset($this->request->post['email'])) {
  593. $this->data['email'] = $this->request->post['email'];
  594. } elseif (!empty($order_info)) {
  595. $this->data['email'] = $order_info['email'];
  596. } else {
  597. $this->data['email'] = '';
  598. }
  599. if (isset($this->request->post['telephone'])) {
  600. $this->data['telephone'] = $this->request->post['telephone'];
  601. } elseif (!empty($order_info)) {
  602. $this->data['telephone'] = $order_info['telephone'];
  603. } else {
  604. $this->data['telephone'] = '';
  605. }
  606. if (isset($this->request->post['fax'])) {
  607. $this->data['fax'] = $this->request->post['fax'];
  608. } elseif (!empty($order_info)) {
  609. $this->data['fax'] = $order_info['fax'];
  610. } else {
  611. $this->data['fax'] = '';
  612. }
  613. $this->load->model('sale/customer');
  614. if (isset($this->request->post['customer_id'])) {
  615. $this->data['addresses'] = $this->model_sale_customer->getAddresses($this->request->post['customer_id']);
  616. } elseif (!empty($order_info)) {
  617. $this->data['addresses'] = $this->model_sale_customer->getAddresses($order_info['customer_id']);
  618. } else {
  619. $this->data['addresses'] = array();
  620. }
  621. if (isset($this->request->post['shipping_firstname'])) {
  622. $this->data['shipping_firstname'] = $this->request->post['shipping_firstname'];
  623. } elseif (!empty($order_info)) {
  624. $this->data['shipping_firstname'] = $order_info['shipping_firstname'];
  625. } else {
  626. $this->data['shipping_firstname'] = '';
  627. }
  628. if (isset($this->request->post['shipping_lastname'])) {
  629. $this->data['shipping_lastname'] = $this->request->post['shipping_lastname'];
  630. } elseif (!empty($order_info)) {
  631. $this->data['shipping_lastname'] = $order_info['shipping_lastname'];
  632. } else {
  633. $this->data['shipping_lastname'] = '';
  634. }
  635. if (isset($this->request->post['shipping_company'])) {
  636. $this->data['shipping_company'] = $this->request->post['shipping_company'];
  637. } elseif (!empty($order_info)) {
  638. $this->data['shipping_company'] = $order_info['shipping_company'];
  639. } else {
  640. $this->data['shipping_company'] = '';
  641. }
  642. if (isset($this->request->post['shipping_address_1'])) {
  643. $this->data['shipping_address_1'] = $this->request->post['shipping_address_1'];
  644. } elseif (!empty($order_info)) {
  645. $this->data['shipping_address_1'] = $order_info['shipping_address_1'];
  646. } else {
  647. $this->data['shipping_address_1'] = '';
  648. }
  649. if (isset($this->request->post['shipping_address_2'])) {
  650. $this->data['shipping_address_2'] = $this->request->post['shipping_address_2'];
  651. } elseif (!empty($order_info)) {
  652. $this->data['shipping_address_2'] = $order_info['shipping_address_2'];
  653. } else {
  654. $this->data['shipping_address_2'] = '';
  655. }
  656. if (isset($this->request->post['shipping_city'])) {
  657. $this->data['shipping_city'] = $this->request->post['shipping_city'];
  658. } elseif (!empty($order_info)) {
  659. $this->data['shipping_city'] = $order_info['shipping_city'];
  660. } else {
  661. $this->data['shipping_city'] = '';
  662. }
  663. if (isset($this->request->post['shipping_postcode'])) {
  664. $this->data['shipping_postcode'] = $this->request->post['shipping_postcode'];
  665. } elseif (!empty($order_info)) {
  666. $this->data['shipping_postcode'] = $order_info['shipping_postcode'];
  667. } else {
  668. $this->data['shipping_postcode'] = '';
  669. }
  670. if (isset($this->request->post['shipping_country_id'])) {
  671. $this->data['shipping_country_id'] = $this->request->post['shipping_country_id'];
  672. } elseif (!empty($order_info)) {
  673. $this->data['shipping_country_id'] = $order_info['shipping_country_id'];
  674. } else {
  675. $this->data['shipping_country_id'] = '';
  676. }
  677. if (isset($this->request->post['shipping_zone_id'])) {
  678. $this->data['shipping_zone_id'] = $this->request->post['shipping_zone_id'];
  679. } elseif (!empty($order_info)) {
  680. $this->data['shipping_zone_id'] = $order_info['shipping_zone_id'];
  681. } else {
  682. $this->data['shipping_zone_id'] = '';
  683. }
  684. if (isset($this->request->post['shipping_method'])) {
  685. $this->data['shipping_method'] = $this->request->post['shipping_method'];
  686. } elseif (!empty($order_info)) {
  687. $this->data['shipping_method'] = $order_info['shipping_method'];
  688. } else {
  689. $this->data['shipping_method'] = '';
  690. }
  691. if (isset($this->request->post['payment_firstname'])) {
  692. $this->data['payment_firstname'] = $this->request->post['payment_firstname'];
  693. } elseif (!empty($order_info)) {
  694. $this->data['payment_firstname'] = $order_info['payment_firstname'];
  695. } else {
  696. $this->data['payment_firstname'] = '';
  697. }
  698. if (isset($this->request->post['payment_lastname'])) {
  699. $this->data['payment_lastname'] = $this->request->post['payment_lastname'];
  700. } elseif (!empty($order_info)) {
  701. $this->data['payment_lastname'] = $order_info['payment_lastname'];
  702. } else {
  703. $this->data['payment_lastname'] = '';
  704. }
  705. if (isset($this->request->post['payment_company'])) {
  706. $this->data['payment_company'] = $this->request->post['payment_company'];
  707. } elseif (!empty($order_info)) {
  708. $this->data['payment_company'] = $order_info['payment_company'];
  709. } else {
  710. $this->data['payment_company'] = '';
  711. }
  712. if (isset($this->request->post['payment_address_1'])) {
  713. $this->data['payment_address_1'] = $this->request->post['payment_address_1'];
  714. } elseif (!empty($order_info)) {
  715. $this->data['payment_address_1'] = $order_info['payment_address_1'];
  716. } else {
  717. $this->data['payment_address_1'] = '';
  718. }
  719. if (isset($this->request->post['payment_address_2'])) {
  720. $this->data['payment_address_2'] = $this->request->post['payment_address_2'];
  721. } elseif (!empty($order_info)) {
  722. $this->data['payment_address_2'] = $order_info['payment_address_2'];
  723. } else {
  724. $this->data['payment_address_2'] = '';
  725. }
  726. if (isset($this->request->post['payment_city'])) {
  727. $this->data['payment_city'] = $this->request->post['payment_city'];
  728. } elseif (!empty($order_info)) {
  729. $this->data['payment_city'] = $order_info['payment_city'];
  730. } else {
  731. $this->data['payment_city'] = '';
  732. }
  733. if (isset($this->request->post['payment_postcode'])) {
  734. $this->data['payment_postcode'] = $this->request->post['payment_postcode'];
  735. } elseif (!empty($order_info)) {
  736. $this->data['payment_postcode'] = $order_info['payment_postcode'];
  737. } else {
  738. $this->data['payment_postcode'] = '';
  739. }
  740. if (isset($this->request->post['payment_country_id'])) {
  741. $this->data['payment_country_id'] = $this->request->post['payment_country_id'];
  742. } elseif (!empty($order_info)) {
  743. $this->data['payment_country_id'] = $order_info['payment_country_id'];
  744. } else {
  745. $this->data['payment_country_id'] = '';
  746. }
  747. if (isset($this->request->post['payment_zone_id'])) {
  748. $this->data['payment_zone_id'] = $this->request->post['payment_zone_id'];
  749. } elseif (!empty($order_info)) {
  750. $this->data['payment_zone_id'] = $order_info['payment_zone_id'];
  751. } else {
  752. $this->data['payment_zone_id'] = '';
  753. }
  754. $this->load->model('localisation/country');
  755. $this->data['countries'] = $this->model_localisation_country->getCountries();
  756. if (isset($this->request->post['payment_method'])) {
  757. $this->data['payment_method'] = $this->request->post['payment_method'];
  758. } elseif (!empty($order_info)) {
  759. $this->data['payment_method'] = $order_info['payment_method'];
  760. } else {
  761. $this->data['payment_method'] = '';
  762. }
  763. if (isset($this->request->post['affiliate_id'])) {
  764. $this->data['affiliate_id'] = $this->request->post['affiliate_id'];
  765. } elseif (!empty($order_info)) {
  766. $this->data['affiliate_id'] = $order_info['affiliate_id'];
  767. } else {
  768. $this->data['affiliate_id'] = '';
  769. }
  770. if (isset($this->request->post['affiliate'])) {
  771. $this->data['affiliate'] = $this->request->post['affiliate'];
  772. } elseif (!empty($order_info)) {
  773. $this->data['affiliate'] = $order_info['affiliate_firstname'] . ' ' . $order_info['affiliate_lastname'];
  774. } else {
  775. $this->data['affiliate'] = '';
  776. }
  777. if (isset($this->request->post['order_status_id'])) {
  778. $this->data['order_status_id'] = $this->request->post['order_status_id'];
  779. } elseif (!empty($order_info)) {
  780. $this->data['order_status_id'] = $order_info['order_status_id'];
  781. } else {
  782. $this->data['order_status_id'] = '';
  783. }
  784. $this->load->model('localisation/order_status');
  785. $this->data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
  786. if (isset($this->request->post['comment'])) {
  787. $this->data['comment'] = $this->request->post['comment'];
  788. } elseif (!empty($order_info)) {
  789. $this->data['comment'] = $order_info['comment'];
  790. } else {
  791. $this->data['comment'] = '';
  792. }
  793. if (isset($this->request->post['order_product'])) {
  794. $order_products = $this->request->post['order_product'];
  795. } elseif (isset($this->request->get['order_id'])) {
  796. $order_products = $this->model_sale_order->getOrderProducts($this->request->get['order_id']);
  797. } else {
  798. $order_products = array();
  799. }
  800. $this->load->model('catalog/product');
  801. $this->document->addScript('view/javascript/jquery/ajaxupload.js');
  802. $this->data['order_products'] = array();
  803. foreach ($order_products as $order_product) {
  804. $product_info = $this->model_catalog_product->getProduct($order_product['product_id']);
  805. if ($product_info) {
  806. if (isset($this->request->post['order_product'])) {
  807. $order_option = $order_product['order_option'];
  808. } else {
  809. $order_option = $this->model_sale_order->getOrderOptions($this->request->get['order_id'], $order_product['order_product_id']);
  810. }
  811. $this->data['order_products'][] = array(
  812. 'order_product_id' => $order_product['order_product_id'],
  813. 'order_id' => $order_product['order_id'],
  814. 'product_id' => $product_info['product_id'],
  815. 'name' => $product_info['name'],
  816. 'model' => $product_info['model'],
  817. 'option' => $order_option,
  818. 'quantity' => $order_product['quantity'],
  819. 'price' => $order_product['price'],
  820. 'total' => $order_product['total'],
  821. 'tax' => $order_product['tax']
  822. );
  823. }
  824. }
  825. if (isset($this->request->post['order_total'])) {
  826. $this->data['order_totals'] = $this->request->post['order_total'];
  827. } elseif (isset($this->request->get['order_id'])) {
  828. $this->data['order_totals'] = $this->model_sale_order->getOrderTotals($this->request->get['order_id']);
  829. } else {
  830. $this->data['order_totals'] = array();
  831. }
  832. $this->template = 'sale/order_form.tpl';
  833. $this->children = array(
  834. 'common/header',
  835. 'common/footer'
  836. );
  837. $this->response->setOutput($this->render());
  838. }
  839. public function info() {
  840. $this->load->model('sale/order');
  841. if (isset($this->request->get['order_id'])) {
  842. $order_id = $this->request->get['order_id'];
  843. } else {
  844. $order_id = 0;
  845. }
  846. $order_info = $this->model_sale_order->getOrder($order_id);
  847. if ($order_info) {
  848. $this->load->language('sale/order');
  849. $this->document->setTitle($this->language->get('heading_title'));
  850. $this->data['heading_title'] = $this->language->get('heading_title');
  851. $this->data['text_order_id'] = $this->language->get('text_order_id');
  852. $this->data['text_invoice_no'] = $this->language->get('text_invoice_no');
  853. $this->data['text_invoice_date'] = $this->language->get('text_invoice_date');
  854. $this->data['text_store_name'] = $this->language->get('text_store_name');
  855. $this->data['text_store_url'] = $this->language->get('text_store_url');
  856. $this->data['text_customer'] = $this->language->get('text_customer');
  857. $this->data['text_customer_group'] = $this->language->get('text_customer_group');
  858. $this->data['text_email'] = $this->language->get('text_email');
  859. $this->data['text_ip'] = $this->language->get('text_ip');
  860. $this->data['text_telephone'] = $this->language->get('text_telephone');
  861. $this->data['text_fax'] = $this->language->get('text_fax');
  862. $this->data['text_total'] = $this->language->get('text_total');
  863. $this->data['text_reward'] = $this->language->get('text_reward');
  864. $this->data['text_order_status'] = $this->language->get('text_order_status');
  865. $this->data['text_comment'] = $this->language->get('text_comment');
  866. $this->data['text_affiliate'] = $this->language->get('text_affiliate');
  867. $this->data['text_commission'] = $this->language->get('text_commission');
  868. $this->data['text_date_added'] = $this->language->get('text_date_added');
  869. $this->data['text_date_modified'] = $this->language->get('text_date_modified');
  870. $this->data['text_firstname'] = $this->language->get('text_firstname');
  871. $this->data['text_lastname'] = $this->language->get('text_lastname');
  872. $this->data['text_company'] = $this->language->get('text_company');
  873. $this->data['text_address_1'] = $this->language->get('text_address_1');
  874. $this->data['text_address_2'] = $this->language->get('text_address_2');
  875. $this->data['text_city'] = $this->language->get('text_city');
  876. $this->data['text_postcode'] = $this->language->get('text_postcode');
  877. $this->data['text_zone'] = $this->language->get('text_zone');
  878. $this->data['text_zone_code'] = $this->language->get('text_zone_code');
  879. $this->data['text_country'] = $this->language->get('text_country');
  880. $this->data['text_shipping_method'] = $this->language->get('text_shipping_method');
  881. $this->data['text_payment_method'] = $this->language->get('text_payment_method');
  882. $this->data['text_download'] = $this->language->get('text_download');
  883. $this->data['text_wait'] = $this->language->get('text_wait');
  884. $this->data['text_create_invoice_no'] = $this->language->get('text_create_invoice_no');
  885. $this->data['text_reward_add'] = $this->language->get('text_reward_add');
  886. $this->data['text_reward_remove'] = $this->language->get('text_reward_remove');
  887. $this->data['text_commission_add'] = $this->language->get('text_commission_add');
  888. $this->data['text_commission_remove'] = $this->language->get('text_commission_remove');
  889. $this->data['text_credit_add'] = $this->language->get('text_credit_add');
  890. $this->data['text_credit_remove'] = $this->language->get('text_credit_remove');
  891. $this->data['column_product'] = $this->language->get('column_product');
  892. $this->data['column_model'] = $this->language->get('column_model');
  893. $this->data['column_quantity'] = $this->language->get('column_quantity');
  894. $this->data['column_price'] = $this->language->get('column_price');
  895. $this->data['column_total'] = $this->language->get('column_total');
  896. $this->data['column_download'] = $this->language->get('column_download');
  897. $this->data['column_filename'] = $this->language->get('column_filename');
  898. $this->data['column_remaining'] = $this->language->get('column_remaining');
  899. $this->data['entry_order_status'] = $this->language->get('entry_order_status');
  900. $this->data['entry_notify'] = $this->language->get('entry_notify');
  901. $this->data['entry_comment'] = $this->language->get('entry_comment');
  902. $this->data['button_invoice'] = $this->language->get('button_invoice');
  903. $this->data['button_cancel'] = $this->language->get('button_cancel');
  904. $this->data['button_add_history'] = $this->language->get('button_add_history');
  905. $this->data['tab_order'] = $this->language->get('tab_order');
  906. $this->data['tab_payment'] = $this->language->get('tab_payment');
  907. $this->data['tab_shipping'] = $this->language->get('tab_shipping');
  908. $this->data['tab_product'] = $this->language->get('tab_product');
  909. $this->data['tab_order_history'] = $this->language->get('tab_order_history');
  910. $this->data['token'] = $this->session->data['token'];
  911. $url = '';
  912. if (isset($this->request->get['filter_order_id'])) {
  913. $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
  914. }
  915. if (isset($this->request->get['filter_customer'])) {
  916. $url .= '&filter_customer=' . $this->request->get['filter_customer'];
  917. }
  918. if (isset($this->request->get['filter_order_status_id'])) {
  919. $url .= '&filter_order_status_id=' . $this->request->get['filter_order_status_id'];
  920. }
  921. if (isset($this->request->get['filter_total'])) {
  922. $url .= '&filter_total=' . $this->request->get['filter_total'];
  923. }
  924. if (isset($this->request->get['filter_date_added'])) {
  925. $url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
  926. }
  927. if (isset($this->request->get['filter_date_modified'])) {
  928. $url .= '&filter_date_modified=' . $this->request->get['filter_date_modified'];
  929. }
  930. if (isset($this->request->get['sort'])) {
  931. $url .= '&sort=' . $this->request->get['sort'];
  932. }
  933. if (isset($this->request->get['order'])) {
  934. $url .= '&order=' . $this->request->get['order'];
  935. }
  936. if (isset($this->request->get['page'])) {
  937. $url .= '&page=' . $this->request->get['page'];
  938. }
  939. $this->data['breadcrumbs'] = array();
  940. $this->data['breadcrumbs'][] = array(
  941. 'text' => $this->language->get('text_home'),
  942. 'href' => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
  943. 'separator' => false
  944. );
  945. $this->data['breadcrumbs'][] = array(
  946. 'text' => $this->language->get('heading_title'),
  947. 'href' => $this->url->link('sale/order', 'token=' . $this->session->data['token'], 'SSL'),
  948. 'separator' => ' :: '
  949. );
  950. $this->data['invoice'] = $this->url->link('sale/order/invoice', 'token=' . $this->session->data['token'] . '&order_id=' . (int)$this->request->get['order_id'], 'SSL');
  951. $this->data['cancel'] = $this->url->link('sale/order', 'token=' . $this->session->data['token'] . $url, 'SSL');
  952. $this->data['order_id'] = $this->request->get['order_id'];
  953. if ($order_info['invoice_no']) {
  954. $this->data['invoice_no'] = $order_info['invoice_prefix'] . $order_info['invoice_no'];
  955. } else {
  956. $this->data['invoice_no'] = '';
  957. }
  958. $this->data['store_name'] = $order_info['store_name'];
  959. $this->data['store_url'] = $order_info['store_url'];
  960. $this->data['firstname'] = $order_info['firstname'];
  961. $this->data['lastname'] = $order_info['lastname'];
  962. if ($order_info['customer_id']) {
  963. $this->data['customer'] = $this->url->link('sale/customer/update', 'token=' . $this->session->data['token'] . '&customer_id=' . $order_info['customer_id'], 'SSL');
  964. } else {
  965. $this->data['customer'] = '';
  966. }
  967. $this->load->model('sale/customer_group');
  968. $customer_group_info = $this->model_sale_customer_group->getCustomerGroup($order_info['customer_group_id']);
  969. if ($customer_group_info) {
  970. $this->data['customer_group'] = $customer_group_info['name'];
  971. } else {
  972. $this->data['customer_group'] = '';
  973. }
  974. $this->data['email'] = $order_info['email'];
  975. $this->data['ip'] = $order_info['ip'];
  976. $this->data['telephone'] = $order_info['telephone'];
  977. $this->data['fax'] = $order_info['fax'];
  978. $this->data['comment'] = nl2br($order_info['comment']);
  979. $this->data['shipping_method'] = $order_info['shipping_method'];
  980. $this->data['payment_method'] = $order_info['payment_method'];
  981. $this->data['total'] = $this->currency->format($order_info['total'], $order_info['currency_code'], $order_info['currency_value']);
  982. $this->data['reward'] = $order_info['reward'];
  983. if ($order_info['total'] < 0) {
  984. $this->data['credit'] = $order_info['total'];
  985. } else {
  986. $this->data['credit'] = 0;
  987. }
  988. $this->load->model('sale/customer');
  989. $this->data['credit_total'] = $this->model_sale_customer->getTotalTransactionsByOrderId($this->request->get['order_id']);
  990. $this->data['reward_total'] = $this->model_sale_customer->getTotalCustomerRewardsByOrderId($this->request->get['order_id']);
  991. $this->data['affiliate_firstname'] = $order_info['affiliate_firstname'];
  992. $this->data['affiliate_lastname'] = $order_info['affiliate_lastname'];
  993. if ($order_info['affiliate_id']) {
  994. $this->data['affiliate'] = $this->url->link('sale/affiliate/update', 'token=' . $this->session->data['token'] . '&affiliate_id=' . $order_info['affiliate_id'], 'SSL');
  995. } else {
  996. $this->data['affiliate'] = '';
  997. }
  998. $this->data['commission'] = $this->currency->format($order_info['commission'], $order_info['currency_code'], $order_info['currency_value']);
  999. $this->load->model('sale/affiliate');
  1000. $this->data['commission_total'] = $this->model_sale_affiliate->getTotalTransactionsByOrderId($this->request->get['order_id']);
  1001. $this->load->model('localisation/order_status');
  1002. $order_status_info = $this->model_localisation_order_status->getOrderStatus($order_info['order_status_id']);
  1003. if ($order_status_info) {
  1004. $this->data['order_status'] = $order_status_info['name'];
  1005. } else {
  1006. $this->data['order_status'] = '';
  1007. }
  1008. $this->data['date_added'] = date($this->language->get('date_format_short'), strtotime($order_info['date_added']));
  1009. $this->data['date_modified'] = date($thi

Large files files are truncated, but you can click here to view the full file