poma1

public function insert()

Oct 15th, 2016
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.70 KB | None | 0 0
  1. public function insert()
  2.     {
  3.         $this->language->load('account/order');
  4.  
  5.         if (isset($this->request->get['order_id'])) {
  6.             $order_id = $this->request->get['order_id'];
  7.         } else {
  8.             $order_id = 0;
  9.         }
  10.  
  11.         if (!$this->customer->isLogged()) {
  12.             $this->session->data['redirect'] = $this->url->link('account/order/info', 'order_id=' . $order_id, 'SSL');
  13.  
  14.             $this->redirect($this->url->link('account/login', '', 'SSL'));
  15.         }
  16.  
  17.         $this->load->model('account/order');
  18.  
  19.         $order_info = $this->model_account_order->getOrder($order_id);
  20.  
  21.  
  22.         $this->data['text_order_detail'] = $this->language->get('text_order_detail');
  23.         $this->data['text_order_id'] = $this->language->get('text_order_id');
  24.         $this->data['text_date_added'] = $this->language->get('text_date_added');
  25.         $this->data['text_post_date'] = $this->language->get('text_post_date');
  26.         $this->data['column_comment'] = $this->language->get('column_comment');
  27.         $this->data['button_return'] = $this->language->get('button_return');
  28.         $this->data['button_continue'] = $this->language->get('button_continue');
  29.  
  30.  
  31.  
  32.         if ($order_info['ttn']) {
  33.             $this->data['ttn'] = $order_info['ttn'];
  34.         } else {
  35.             $this->data['ttn'] = '';
  36.         }
  37.  
  38.         $this->data['order_id'] = $this->request->get['order_id'];
  39.         $this->data['date_added'] = date($this->language->get('date_format_short'), strtotime($order_info['date_added']));
  40.         $this->data['post_date'] = date($this->language->get('date_format_short'), strtotime($order_info['post_date']));
  41.  
  42.  
  43.         $this->language->load('account/return');
  44.  
  45.         $this->load->model('account/return');
  46.  
  47.         if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
  48.             $this->model_account_return->addReturn($this->request->post);
  49.  
  50.             $this->redirect($this->url->link('account/return/success', '', 'SSL'));
  51.         }
  52.  
  53.         $this->document->setTitle($this->language->get('heading_title'));
  54.  
  55.         $this->data['breadcrumbs'] = array();
  56.  
  57.         $this->data['breadcrumbs'][] = array(
  58.             'text'      => $this->language->get('text_home'),
  59.             'href'      => $this->url->link('common/home'),
  60.             'separator' => false
  61.         );
  62.  
  63.         $this->data['breadcrumbs'][] = array(
  64.             'text'      => $this->language->get('text_account'),
  65.             'href'      => $this->url->link('account/account', '', 'SSL'),
  66.             'separator' => $this->language->get('text_separator')
  67.         );
  68.  
  69.         $this->data['breadcrumbs'][] = array(
  70.             'text'      => $this->language->get('heading_title'),
  71.             'href'      => $this->url->link('account/return/insert', '', 'SSL'),
  72.             'separator' => $this->language->get('text_separator')
  73.         );
  74.  
  75.         $this->data['heading_title'] = $this->language->get('heading_title');
  76.         $this->data['text_description'] = $this->language->get('text_description');
  77.         $this->data['entry_order_id'] = $this->language->get('entry_order_id');
  78.         $this->data['entry_date_ordered'] = $this->language->get('entry_date_ordered');
  79.         $this->data['entry_reason'] = $this->language->get('entry_reason');
  80.         $this->data['entry_fault_detail'] = $this->language->get('entry_fault_detail');
  81.         $this->data['button_continue'] = $this->language->get('button_continue');
  82.         $this->data['button_back'] = $this->language->get('button_back');
  83.  
  84.         if (isset($this->error['warning'])) {
  85.             $this->data['error_warning'] = $this->error['warning'];
  86.         } else {
  87.             $this->data['error_warning'] = '';
  88.         }
  89.  
  90.         if (isset($this->error['reason'])) {
  91.             $this->data['error_reason'] = $this->error['reason'];
  92.         } else {
  93.             $this->data['error_reason'] = '';
  94.         }
  95.  
  96.         if (isset($this->request->post['order_status_id'])) {
  97.             $this->data['order_status_id'] = $this->request->post['order_status_id'];
  98.         } else {
  99.             $this->data['order_status_id'] = '';
  100.         }
  101.  
  102.         $this->data['action'] = $this->url->link('account/return/insert', '', 'SSL');
  103.  
  104.  
  105.  
  106.         $this->load->model('localisation/return_reason');
  107.  
  108.         $this->data['return_reasons'] = $this->model_localisation_return_reason->getReturnReasons();
  109.  
  110.         if (isset($this->request->post['comment'])) {
  111.             $this->data['comment'] = $this->request->post['comment'];
  112.         } else {
  113.             $this->data['comment'] = '';
  114.         }
  115.  
  116.         $this->data['back'] = $this->url->link('account/account', '', 'SSL');
  117.  
  118.         if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/account/return_form.tpl')) {
  119.             $this->template = $this->config->get('config_template') . '/template/account/return_form.tpl';
  120.         } else {
  121.             $this->template = 'default/template/account/return_form.tpl';
  122.         }
  123.  
  124.         $this->children = array(
  125.             'common/column_left',
  126.             'common/column_right',
  127.             'common/content_top',
  128.             'common/content_bottom',
  129.             'common/footer',
  130.             'common/header'
  131.         );
  132.  
  133.         $this->response->setOutput($this->render());
  134.     }
Advertisement
Add Comment
Please, Sign In to add comment