$this->load->model('sale/order');
$this->load->model('payment/amazon_checkout');
$this->language->load('sale/order');
$this->language->load('payment/amazon_checkout');
$this->document->addScript('view/javascript/jquery/ajaxupload.js');
$order_id = $this->request->get['order_id'];
$amazon_order_info = $this->model_payment_amazon_checkout->getOrder($order_id);
if ($amazon_order_info) {
$order_products = $this->model_sale_order->getOrderProducts($order_id);
$order_info = $this->model_sale_order->getOrder($order_id);
$this->data['products'] = array();
foreach ($order_products as $product) {
$product_options = $this->model_sale_order->getOrderOptions($order_id, $product['order_product_id']);
$order_item_code = '';
if (isset($amazon_order_info['products'][$product['order_product_id']])) {
$order_item_code = $amazon_order_info['products'][$product['order_product_id']]['amazon_order_item_code'];
}
$this->data['products'][] = array(
'amazon_order_item_code' => $order_item_code,
'order_product_id' => $product['order_product_id'],
'product_id' => $product['product_id'],
'name' => $product['name'],
'model' => $product['model'],
'option' => $product_options,
'quantity' => $product['quantity'],
'price' => $this->currency->format($product['price'], $order_info['currency_code'], $order_info['currency_value']),
'total' => $this->currency->format($product['total'], $order_info['currency_code'], $order_info['currency_value']),
'href' => $this->url->link('catalog/product/update', 'token=' . $this->session->data['token'] . '&product_id=' . $product['product_id'], 'SSL')
);
}
$this->data['report_submissions'] = $this->model_payment_amazon_checkout->getReportSubmissions($order_id);
$this->data['text_amazon_details'] = $this->language->get('text_amazon_details');
$this->data['text_amazon_order_id'] = $this->language->get('text_amazon_order_id');
$this->data['text_upload'] = $this->language->get('text_upload');
$this->data['text_upload_template'] = $this->language->get('text_upload_template');
$this->data['tab_order_adjustment'] = $this->language->get('tab_order_adjustment');
$this->data['column_submission_id'] = $this->language->get('column_submission_id');
$this->data['column_status'] = $this->language->get('column_status');
$this->data['column_text'] = $this->language->get('column_text');
$this->data['column_amazon_order_item_code'] = $this->language->get('column_amazon_order_item_code');
$this->data['column_product'] = $this->language->get('column_product');
$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['help_adjustment'] = $this->language->get('help_adjustment');
$this->data['text_download'] = sprintf($this->language->get('text_download'), $this->url->link('payment/amazon_checkout/template', 'token=' . $this->session->data['token'], 'SSL'));
$this->data['amazon_order_id'] = $amazon_order_info['amazon_order_id'];
$this->data['token'] = $this->session->data['token'];
$this->data['order_id'] = $order_id;
$this->template = 'payment/amazon_checkout_order.tpl';
$this->response->setOutput($this->render());
}