$this->load->model('sale/return');
if (isset($this->request->get['return_id'])) {
$return_id = $this->request->get['return_id'];
} else {
$return_id = 0;
}
$return_info = $this->model_sale_return->getReturn($return_id);
if ($return_info) {
$this->language->load('sale/return');
$this->document->setTitle($this->language->get('heading_title'));
$this->data['heading_title'] = $this->language->get('heading_title');
$this->data['text_wait'] = $this->language->get('text_wait');
$this->data['text_return_id'] = $this->language->get('text_return_id');
$this->data['text_order_id'] = $this->language->get('text_order_id');
$this->data['text_date_ordered'] = $this->language->get('text_date_ordered');
$this->data['text_customer'] = $this->language->get('text_customer');
$this->data['text_email'] = $this->language->get('text_email');
$this->data['text_telephone'] = $this->language->get('text_telephone');
$this->data['text_return_status'] = $this->language->get('text_return_status');
$this->data['text_date_added'] = $this->language->get('text_date_added');
$this->data['text_date_modified'] = $this->language->get('text_date_modified');
$this->data['text_product'] = $this->language->get('text_product');
$this->data['text_model'] = $this->language->get('text_model');
$this->data['text_quantity'] = $this->language->get('text_quantity');
$this->data['text_return_reason'] = $this->language->get('text_return_reason');
$this->data['text_opened'] = $this->language->get('text_opened');
$this->data['text_comment'] = $this->language->get('text_comment');
$this->data['text_return_action'] = $this->language->get('text_return_action');
$this->data['entry_return_status'] = $this->language->get('entry_return_status');
$this->data['entry_notify'] = $this->language->get('entry_notify');
$this->data['entry_comment'] = $this->language->get('entry_comment');
$this->data['button_save'] = $this->language->get('button_save');
$this->data['button_cancel'] = $this->language->get('button_cancel');
$this->data['button_add_history'] = $this->language->get('button_add_history');
$this->data['tab_return'] = $this->language->get('tab_return');
$this->data['tab_product'] = $this->language->get('tab_product');
$this->data['tab_history'] = $this->language->get('tab_history');
$url = '';
if (isset($this->request->get['filter_return_id'])) {
$url .= '&filter_return_id=' . $this->request->get['filter_return_id'];
}
if (isset($this->request->get['filter_order_id'])) {
$url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
}
if (isset($this->request->get['filter_customer'])) {
$url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8'));
}
if (isset($this->request->get['filter_product'])) {
$url .= '&filter_product=' . urlencode(html_entity_decode($this->request->get['filter_product'], ENT_QUOTES, 'UTF-8'));
}
if (isset($this->request->get['filter_model'])) {
$url .= '&filter_model=' . urlencode(html_entity_decode($this->request->get['filter_model'], ENT_QUOTES, 'UTF-8'));
}
if (isset($this->request->get['filter_return_status_id'])) {
$url .= '&filter_return_status_id=' . $this->request->get['filter_return_status_id'];
}
if (isset($this->request->get['filter_date_added'])) {
$url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
}
if (isset($this->request->get['filter_date_modified'])) {
$url .= '&filter_date_modified=' . $this->request->get['filter_date_modified'];
}
if (isset($this->request->get['sort'])) {
$url .= '&sort=' . $this->request->get['sort'];
}
if (isset($this->request->get['order'])) {
$url .= '&order=' . $this->request->get['order'];
}
if (isset($this->request->get['page'])) {
$url .= '&page=' . $this->request->get['page'];
}
$this->data['breadcrumbs'] = array();
$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('text_home'),
'href' => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
'separator' => false
);
$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title'),
'href' => $this->url->link('sale/return', 'token=' . $this->session->data['token'] . $url, 'SSL'),
'separator' => ' :: '
);
$this->data['cancel'] = $this->url->link('sale/return', 'token=' . $this->session->data['token'] . $url, 'SSL');
$this->load->model('sale/order');
$order_info = $this->model_sale_order->getOrder($return_info['order_id']);
$this->data['token'] = $this->session->data['token'];
$this->data['return_id'] = $return_info['return_id'];
$this->data['order_id'] = $return_info['order_id'];
if ($return_info['order_id'] && $order_info) {
$this->data['order'] = $this->url->link('sale/order/info', 'token=' . $this->session->data['token'] . '&order_id=' . $return_info['order_id'], 'SSL');
} else {
$this->data['order'] = '';
}
$this->data['date_ordered'] = date($this->language->get('date_format_short'), strtotime($return_info['date_ordered']));
$this->data['firstname'] = $return_info['firstname'];
$this->data['lastname'] = $return_info['lastname'];
if ($return_info['customer_id']) {
$this->data['customer'] = $this->url->link('sale/customer/update', 'token=' . $this->session->data['token'] . '&customer_id=' . $return_info['customer_id'], 'SSL');
} else {
$this->data['customer'] = '';
}
$this->data['email'] = $return_info['email'];
$this->data['telephone'] = $return_info['telephone'];
$this->load->model('localisation/return_status');
$return_status_info = $this->model_localisation_return_status->getReturnStatus($return_info['return_status_id']);
if ($return_status_info) {
$this->data['return_status'] = $return_status_info['name'];
} else {
$this->data['return_status'] = '';
}
$this->data['date_added'] = date($this->language->get('date_format_short'), strtotime($return_info['date_added']));
$this->data['date_modified'] = date($this->language->get('date_format_short'), strtotime($return_info['date_modified']));
$this->data['product'] = $return_info['product'];
$this->data['model'] = $return_info['model'];
$this->data['quantity'] = $return_info['quantity'];
$this->load->model('localisation/return_reason');
$return_reason_info = $this->model_localisation_return_reason->getReturnReason($return_info['return_reason_id']);
if ($return_reason_info) {
$this->data['return_reason'] = $return_reason_info['name'];
} else {
$this->data['return_reason'] = '';
}
$this->data['opened'] = $return_info['opened'] ? $this->language->get('text_yes') : $this->language->get('text_no');
$this->data['comment'] = nl2br($return_info['comment']);
$this->load->model('localisation/return_action');
$this->data['return_actions'] = $this->model_localisation_return_action->getReturnActions();
$this->data['return_action_id'] = $return_info['return_action_id'];
$this->data['return_statuses'] = $this->model_localisation_return_status->getReturnStatuses();
$this->data['return_status_id'] = $return_info['return_status_id'];
$this->template = 'sale/return_info.tpl';
$this->children = array(
'common/header',
'common/footer'
);
$this->response->setOutput($this->render());
} else {
$this->language->load('error/not_found');
$this->document->setTitle($this->language->get('heading_title'));
$this->data['heading_title'] = $this->language->get('heading_title');
$this->data['text_not_found'] = $this->language->get('text_not_found');
$this->data['breadcrumbs'] = array();
$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('text_home'),
'href' => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
'separator' => false
);
$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title'),
'href' => $this->url->link('error/not_found', 'token=' . $this->session->data['token'], 'SSL'),
'separator' => ' :: '
);
$this->template = 'error/not_found.tpl';
$this->children = array(
'common/header',
'common/footer'
);
$this->response->setOutput($this->render());
}