Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function change()
- {
- $this->language->load('account/order');
- if (isset($this->request->get['order_id'])) {
- $order_id = $this->request->get['order_id'];
- } else {
- $order_id = 0;
- }
- if (!$this->customer->isLogged()) {
- $this->session->data['redirect'] = $this->url->link('account/order/info', 'order_id=' . $order_id, 'SSL');
- $this->redirect($this->url->link('account/login', '', 'SSL'));
- }
- $this->load->model('account/order');
- $order_info = $this->model_account_order->getOrder($order_id);
- if ($order_info) {
- $this->document->setTitle($this->language->get('text_order'));
- $this->data['breadcrumbs'] = array();
- $this->data['breadcrumbs'][] = array(
- 'text' => $this->language->get('text_home'),
- 'href' => $this->url->link('common/home'),
- 'separator' => false
- );
- $this->data['breadcrumbs'][] = array(
- 'text' => $this->language->get('text_account'),
- 'href' => $this->url->link('account/account', '', 'SSL'),
- 'separator' => $this->language->get('text_separator')
- );
- $url = '';
- if (isset($this->request->get['page'])) {
- $url .= '&page=' . $this->request->get['page'];
- }
- $this->data['breadcrumbs'][] = array(
- 'text' => $this->language->get('heading_title'),
- 'href' => $this->url->link('account/order', $url, 'SSL'),
- 'separator' => $this->language->get('text_separator')
- );
- $this->data['breadcrumbs'][] = array(
- 'text' => $this->language->get('text_order'),
- 'href' => $this->url->link('account/order/info', 'order_id=' . $this->request->get['order_id'] . $url, 'SSL'),
- 'separator' => $this->language->get('text_separator')
- );
- $this->data['heading_title'] = $this->language->get('text_order');
- $this->data['text_order_detail'] = $this->language->get('text_order_detail');
- $this->data['text_invoice_no'] = $this->language->get('text_invoice_no');
- $this->data['text_order_id'] = $this->language->get('text_order_id');
- $this->data['text_date_added'] = $this->language->get('text_date_added');
- $this->data['text_post_date'] = $this->language->get('text_post_date');
- $this->data['text_shipping_method'] = $this->language->get('text_shipping_method');
- $this->data['text_shipping_address'] = $this->language->get('text_shipping_address');
- $this->data['text_payment_method'] = $this->language->get('text_payment_method');
- $this->data['text_payment_address'] = $this->language->get('text_payment_address');
- $this->data['text_history'] = $this->language->get('text_history');
- $this->data['text_comment'] = $this->language->get('text_comment');
- $this->data['column_name'] = $this->language->get('column_name');
- $this->data['column_model'] = $this->language->get('column_model');
- $this->data['column_quantity'] = $this->language->get('column_quantity');
- $this->data['column_price'] = $this->language->get('column_price');
- $this->data['column_total'] = $this->language->get('column_total');
- $this->data['column_action'] = $this->language->get('column_action');
- $this->data['column_date_added'] = $this->language->get('column_date_added');
- $this->data['column_post_date'] = $this->language->get('column_post_date');
- $this->data['column_status'] = $this->language->get('column_status');
- $this->data['column_comment'] = $this->language->get('column_comment');
- $this->data['button_return'] = $this->language->get('button_return');
- $this->data['button_continue'] = $this->language->get('button_continue');
- if ($order_info['invoice_no']) {
- $this->data['invoice_no'] = $order_info['invoice_prefix'] . $order_info['invoice_no'];
- } else {
- $this->data['invoice_no'] = '';
- }
- if ($order_info['sum_']) {
- $this->data['sum_'] = $order_info['sum_'];
- } else {
- $this->data['sum_'] = '';
- }
- if ($order_info['ttn']) {
- $this->data['ttn'] = $order_info['ttn'];
- } else {
- $this->data['ttn'] = '';
- }
- $this->data['order_id'] = $this->request->get['order_id'];
- $this->data['date_added'] = date($this->language->get('date_format_short'), strtotime($order_info['date_added']));
- $this->data['post_date'] = date($this->language->get('date_format_short'), strtotime($order_info['post_date']));
- if ($order_info['payment_address_format']) {
- $format = $order_info['payment_address_format'];
- } else {
- $format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}';
- }
- $find = array(
- '{firstname}',
- '{lastname}',
- '{company}',
- '{address_1}',
- '{address_2}',
- '{city}',
- '{postcode}',
- '{zone}',
- '{zone_code}',
- '{country}',
- '{telephone}'
- );
- $replace = array(
- 'firstname' => $order_info['payment_firstname'],
- 'lastname' => $order_info['payment_lastname'],
- 'company' => $order_info['payment_company'],
- 'address_1' => $order_info['payment_address_1'],
- 'address_2' => $order_info['payment_address_2'],
- 'city' => $order_info['payment_city'],
- 'postcode' => $order_info['payment_postcode'],
- 'zone' => $order_info['payment_zone'],
- 'zone_code' => $order_info['payment_zone_code'],
- 'country' => $order_info['payment_country'],
- 'telephone' => $order_info['payment_telephone']
- );
- $this->data['payment_address'] = str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\s\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format))));
- $this->data['payment_method'] = $order_info['payment_method'];
- if ($order_info['shipping_address_format']) {
- $format = $order_info['shipping_address_format'];
- } else {
- $format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}' . "\n" . '{telephone}';
- }
- $find = array(
- '{firstname}',
- '{lastname}',
- '{company}',
- '{address_1}',
- '{address_2}',
- '{city}',
- '{postcode}',
- '{zone}',
- '{zone_code}',
- '{country}',
- '{telephone}'
- );
- $replace = array(
- 'firstname' => $order_info['shipping_firstname'],
- 'lastname' => $order_info['shipping_lastname'],
- 'company' => $order_info['shipping_company'],
- 'address_1' => $order_info['shipping_address_1'],
- 'address_2' => $order_info['shipping_address_2'],
- 'city' => $order_info['shipping_city'],
- 'postcode' => $order_info['shipping_postcode'],
- 'zone' => $order_info['shipping_zone'],
- 'zone_code' => $order_info['shipping_zone_code'],
- 'country' => $order_info['shipping_country'],
- 'telephone' => $order_info['telephone'],
- );
- $this->data['shipping_address'] = str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\s\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format))));
- $this->data['shipping_method'] = $order_info['shipping_method'];
- $this->data['shipping_firstname'] = ($order_info['shipping_firstname']);
- $this->data['shipping_zone'] = ($order_info['shipping_zone']);
- $this->data['shipping_city'] = ($order_info['shipping_city']);
- $this->data['payment_address_1'] = ($order_info['payment_address_1']);
- $this->data['telephone'] = ($order_info['telephone']);
- if (isset($this->request->post['telephone'])) {
- $this->data['telephone'] = $this->request->post['telephone'];
- } elseif (!empty($order_info)) {
- $this->data['telephone'] = $order_info['telephone'];
- } else {
- $this->data['telephone'] = $this->customer->getTelephone();
- }
- $this->data['products'] = array();
- $products = $this->model_account_order->getOrderProducts($this->request->get['order_id']);
- foreach ($products as $product) {
- $option_data = array();
- $options = $this->model_account_order->getOrderOptions($this->request->get['order_id'], $product['order_product_id']);
- foreach ($options as $option) {
- if ($option['type'] != 'file') {
- $value = $option['value'];
- } else {
- $value = utf8_substr($option['value'], 0, utf8_strrpos($option['value'], '.'));
- }
- $option_data[] = array(
- 'name' => $option['name'],
- 'value' => (utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value)
- );
- }
- $this->data['products'][] = array(
- 'name' => $product['name'],
- 'model' => $product['model'],
- 'option' => $option_data,
- 'quantity' => $product['quantity'],
- 'image' => $product['image'],
- 'price' => $this->currency->format($product['price'] + ($this->config->get('config_tax') ? $product['tax'] : 0), $order_info['currency_code'], $order_info['currency_value']),
- 'total' => $this->currency->format($product['total'] + ($this->config->get('config_tax') ? ($product['tax'] * $product['quantity']) : 0), $order_info['currency_code'], $order_info['currency_value']),
- 'return' => $this->url->link('account/return/insert', 'order_id=' . $order_info['order_id'] . '&product_id=' . $product['product_id'], 'SSL'),
- 'cancel' => $this->url->link('account/return/insert', 'order_id=' . $order_info['order_id'] . '&product_id=' . $product['product_id'], 'SSL')
- );
- }
- }
- $this->language->load('account/return');
- $this->load->model('account/order');
- if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
- $this->model_account_order->updateOrderChange($this->request->get['order_id'], $this->request->post);
- $this->redirect($this->url->link('account/order/', '', 'SSL'));
- }
- $this->document->setTitle($this->language->get('Изменить'));
- $this->data['heading_title'] = $this->language->get('heading_title');
- $this->data['text_description'] = $this->language->get('text_description');
- $this->data['entry_order_id'] = $this->language->get('entry_order_id');
- $this->data['entry_date_ordered'] = $this->language->get('entry_date_ordered');
- $this->data['entry_reason'] = $this->language->get('entry_reason');
- $this->data['entry_fault_detail'] = $this->language->get('entry_fault_detail');
- $this->data['button_continue'] = $this->language->get('button_continue');
- $this->data['button_back'] = $this->language->get('button_back');
- $this->data['zones'] = $this->model_account_order->getOrderZone();
- $this->data['regions'] = $this->model_account_order->getCodeNovaposhtaCities();
- $this->data['zone'] = $this->request->get['zone'];
- var_dump($this->data['zone']);
- if (isset($this->request->post['telephone'])) {
- $this->data['telephone'] = $this->request->post['telephone'];
- } elseif (!empty($order_info)) {
- $this->data['telephone'] = $order_info['telephone'];
- } else {
- $this->data['telephone'] = $this->customer->getTelephone();
- }
- if (isset($this->request->post['shipping_firstname'])) {
- $this->data['shipping_firstname'] = $this->request->post['shipping_firstname'];
- } elseif (!empty($order_info)) {
- $this->data['shipping_firstname'] = $order_info['shipping_firstname'];
- } else {
- $this->data['shipping_firstname'] = '';
- }
- if (isset($this->request->post['shipping_zone'])) {
- $this->data['shipping_zone'] = $this->request->post['shipping_zone'];
- } elseif (!empty($order_info)) {
- $this->data['shipping_zone'] = $order_info['shipping_zone'];
- } else {
- $this->data['shipping_zone'] = '';
- }
- if (isset($this->request->post['shipping_city'])) {
- $this->data['shipping_city'] = $this->request->post['shipping_city'];
- } elseif (!empty($order_info)) {
- $this->data['shipping_city'] = $order_info['shipping_city'];
- } else {
- $this->data['shipping_city'] = '';
- }
- if (isset($this->request->post['payment_address_1'])) {
- $this->data['payment_address_1'] = $this->request->post['payment_address_1'];
- } elseif (!empty($order_info)) {
- $this->data['payment_address_1'] = $order_info['payment_address_1'];
- } else {
- $this->data['payment_address_1'] = '';
- }
- /*if (isset($this->error['warning'])) {
- $this->data['error_warning'] = $this->error['warning'];
- } else {
- $this->data['error_warning'] = '';
- }*/
- if (isset($this->error['reason'])) {
- $this->data['error_region'] = $this->error['reason'];
- } else {
- $this->data['error_reason'] = '';
- }
- $this->data['action'] = $this->url->link('account/order/change', 'order_id=' . $order_id, 'SSL');
- $this->load->model('localisation/return_reason');
- $this->data['back'] = $this->url->link('account/order', '', 'SSL');
- if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/account/order_change.tpl')) {
- $this->template = $this->config->get('config_template') . '/template/account/order_change.tpl';
- } else {
- $this->template = 'default/template/account/order_change.tpl';
- }
- $this->children = array(
- 'common/column_left',
- 'common/column_right',
- 'common/content_top',
- 'common/content_bottom',
- 'common/footer',
- 'common/header'
- );
- $this->response->setOutput($this->render());
- }
Advertisement
Add Comment
Please, Sign In to add comment