Exemple #1
0
 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     if (isset($this->session->data['order_id'])) {
         $amount = $this->session->data['used_balance'];
         // in default currency
         if ($amount) {
             $transaction_data = array('order_id' => (int) $this->session->data['order_id'], 'amount' => $amount, 'transaction_type' => 'order', 'created_by' => $this->customer->getId(), 'description' => sprintf($this->language->get('text_applied_balance_to_order'), $this->currency->format($this->currency->convert($amount, $this->config->get('config_currency'), $this->session->data['currency']), $this->session->data['currency'], 1), (int) $this->session->data['order_id']));
             $this->customer->debitTransaction($transaction_data);
         }
         // google analytics data for js-script in footer.tpl
         $order = new AOrder($this->registry);
         $order_data = $order->buildOrderData($this->session->data);
         $order_tax = $order_total = $order_shipping = 0.0;
         foreach ($order_data['totals'] as $total) {
             if ($total['total_type'] == 'total') {
                 $order_total += $total['value'];
             } elseif ($total['total_type'] == 'tax') {
                 $order_tax += $total['value'];
             } elseif ($total['total_type'] == 'shipping') {
                 $order_shipping += $total['value'];
             }
         }
         $this->registry->set('google_analytics_data', array('transaction_id' => (int) $this->session->data['order_id'], 'store_name' => $this->config->get('store_name'), 'currency_code' => $order_data['currency'], 'total' => $order_total, 'tax' => $order_tax, 'shipping' => $order_shipping, 'city' => $order_data['shipping_city'], 'state' => $order_data['shipping_zone'], 'country' => $order_data['shipping_country']));
         $this->cart->clear();
         unset($this->session->data['shipping_method'], $this->session->data['shipping_methods'], $this->session->data['payment_method'], $this->session->data['payment_methods'], $this->session->data['guest'], $this->session->data['comment'], $this->session->data['order_id'], $this->session->data['coupon'], $this->session->data['used_balance'], $this->session->data['used_balance_full']);
         //Redirect back. Fix for clearing shopping cart content
         $this->redirect($this->html->getSecureURL('checkout/success'));
     }
     $this->document->setTitle($this->language->get('heading_title'));
     $this->document->resetBreadcrumbs();
     $this->document->addBreadcrumb(array('href' => $this->html->getURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE));
     $this->document->addBreadcrumb(array('href' => $this->html->getURL('checkout/cart'), 'text' => $this->language->get('text_basket'), 'separator' => $this->language->get('text_separator')));
     if ($this->customer->isLogged()) {
         $this->document->addBreadcrumb(array('href' => $this->html->getURL('checkout/shipping'), 'text' => $this->language->get('text_shipping'), 'separator' => $this->language->get('text_separator')));
         $this->document->addBreadcrumb(array('href' => $this->html->getURL('checkout/payment'), 'text' => $this->language->get('text_payment'), 'separator' => $this->language->get('text_separator')));
         $this->document->addBreadcrumb(array('href' => $this->html->getURL('checkout/confirm'), 'text' => $this->language->get('text_confirm'), 'separator' => $this->language->get('text_separator')));
     } else {
         $this->document->addBreadcrumb(array('href' => $this->html->getURL('checkout/guest'), 'text' => $this->language->get('text_guest'), 'separator' => $this->language->get('text_separator')));
         $this->document->addBreadcrumb(array('href' => $this->html->getURL('checkout/guest/confirm'), 'text' => $this->language->get('text_confirm'), 'separator' => $this->language->get('text_separator')));
     }
     $this->document->addBreadcrumb(array('href' => $this->html->getURL('checkout/success'), 'text' => $this->language->get('text_success'), 'separator' => $this->language->get('text_separator')));
     $this->view->assign('heading_title', $this->language->get('heading_title'));
     if ($this->session->data['account'] == 'guest') {
         $this->view->assign('text_message', sprintf($this->language->get('text_message_guest'), $this->html->getURL('content/contact')));
     } else {
         $this->view->assign('text_message', sprintf($this->language->get('text_message'), $this->html->getSecureURL('account/account'), $this->html->getSecureURL('account/history'), $this->html->getURL('content/contact')));
     }
     $this->view->assign('button_continue', $this->language->get('button_continue'));
     $this->view->assign('continue', $this->html->getURL('index/home'));
     $continue = HtmlElementFactory::create(array('type' => 'button', 'name' => 'continue_button', 'text' => $this->language->get('button_continue'), 'style' => 'button'));
     $this->view->assign('continue_button', $continue);
     $this->processTemplate('common/success.tpl');
     //init controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     //is this an embed mode
     $cart_rt = 'checkout/cart';
     if ($this->config->get('embed_mode') == true) {
         $cart_rt = 'r/checkout/cart/embed';
     }
     if (!$this->cart->hasProducts() || !$this->cart->hasStock() && !$this->config->get('config_stock_checkout')) {
         $this->redirect($this->html->getSecureURL($cart_rt));
     }
     //validate if order min/max are met
     if (!$this->cart->hasMinRequirement() || !$this->cart->hasMaxRequirement()) {
         $this->redirect($this->html->getSecureURL($cart_rt));
     }
     if ($this->customer->isLogged()) {
         $this->redirect($this->html->getSecureURL('checkout/shipping'));
     }
     if (!isset($this->session->data['guest'])) {
         $this->redirect($this->html->getSecureURL('checkout/guest_step_1'));
     }
     if ($this->cart->hasShipping()) {
         if (!isset($this->session->data['shipping_method'])) {
             $this->redirect($this->html->getSecureURL('checkout/guest_step_2'));
         }
     } else {
         unset($this->session->data['shipping_method']);
         unset($this->session->data['shipping_methods']);
         //$this->tax->setZone($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
         $this->tax->setZone($this->session->data['country_id'], $this->session->data['zone_id']);
     }
     if (!isset($this->session->data['payment_method'])) {
         $this->redirect($this->html->getSecureURL('checkout/guest_step_2'));
     }
     $this->loadLanguage('checkout/confirm');
     $this->document->setTitle($this->language->get('heading_title'));
     //build and save order
     $this->data = array();
     $order = new AOrder($this->registry);
     $this->data = $order->buildOrderData($this->session->data);
     $this->session->data['order_id'] = $order->saveOrder();
     $this->document->resetBreadcrumbs();
     $this->document->addBreadcrumb(array('href' => $this->html->getURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE));
     $this->document->addBreadcrumb(array('href' => $this->html->getURL($cart_rt), 'text' => $this->language->get('text_basket'), 'separator' => $this->language->get('text_separator')));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('checkout/guest_step_1'), 'text' => $this->language->get('text_guest_step_1'), 'separator' => $this->language->get('text_separator')));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('checkout/guest_step_2'), 'text' => $this->language->get('text_guest_step_2'), 'separator' => $this->language->get('text_separator')));
     $this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('checkout/guest_step_3'), 'text' => $this->language->get('text_confirm'), 'separator' => $this->language->get('text_separator')));
     $this->view->assign('error_warning', $this->error['warning']);
     $this->view->assign('success', $this->session->data['success']);
     if (isset($this->session->data['success'])) {
         unset($this->session->data['success']);
     }
     if ($this->cart->hasShipping()) {
         if (isset($this->session->data['guest']['shipping'])) {
             $shipping_address = $this->session->data['guest']['shipping'];
         } else {
             $shipping_address = $this->session->data['guest'];
         }
         $this->data['shipping_address'] = $this->customer->getFormatedAdress($shipping_address, $shipping_address['address_format']);
     } else {
         $this->data['shipping_address'] = '';
     }
     if (isset($this->session->data['shipping_method']['title'])) {
         $this->data['shipping_method'] = $this->session->data['shipping_method']['title'];
     } else {
         $this->data['shipping_method'] = '';
     }
     $this->data['checkout_shipping'] = $this->html->getSecureURL('checkout/guest_step_2');
     $this->data['checkout_shipping_edit'] = $this->html->getSecureURL('checkout/guest_step_2', '&mode=edit', true);
     $this->data['checkout_shipping_address'] = $this->html->getSecureURL('checkout/guest_step_1');
     $payment_address = $this->session->data['guest'];
     if ($payment_address) {
         $this->data['payment_address'] = $this->customer->getFormatedAdress($payment_address, $payment_address['address_format']);
     } else {
         $this->data['payment_address'] = '';
     }
     if ($this->session->data['payment_method']['id'] != 'no_payment_required') {
         $this->data['payment_method'] = $this->session->data['payment_method']['title'];
     } else {
         $this->data['payment_method'] = '';
     }
     $this->data['checkout_payment'] = $this->html->getSecureURL('checkout/guest_step_2');
     $this->data['checkout_payment_edit'] = $this->html->getSecureURL('checkout/guest_step_2', '&mode=edit', true);
     $this->data['cart'] = $this->html->getSecureURL($cart_rt);
     $this->data['checkout_payment_address'] = $this->html->getSecureURL('checkout/guest_step_1');
     $this->loadModel('tool/seo_url');
     $this->loadModel('tool/image');
     //Format product data specific for confirmation page
     $resource = new AResource('image');
     for ($i = 0; $i < sizeof($this->data['products']); $i++) {
         $product_id = $this->data['products'][$i]['product_id'];
         $thumbnail = $resource->getMainThumb('products', $product_id, $this->config->get('config_image_cart_width'), $this->config->get('config_image_cart_height'), true);
         $tax = $this->tax->calcTotalTaxAmount($this->data['products'][$i]['total'], $this->data['products'][$i]['tax_class_id']);
         $this->data['products'][$i] = array_merge($this->data['products'][$i], array('thumb' => $thumbnail, 'tax' => $this->currency->format($tax), 'price' => $this->currency->format($this->data['products'][$i]['price']), 'total' => $this->currency->format($this->data['products'][$i]['total']), 'href' => $this->html->getSEOURL('product/product', '&product_id=' . $product_id, true)));
     }
     if ($this->config->get('config_checkout_id')) {
         $this->loadModel('catalog/content');
         $content_info = $this->model_catalog_content->getContent($this->config->get('config_checkout_id'));
         if ($content_info) {
             $this->data['text_accept_agree'] = $this->language->get('text_accept_agree');
             $this->data['text_accept_agree_href'] = $this->html->getSEOURL('r/content/content/loadInfo', '&content_id=' . $this->config->get('config_checkout_id'), true);
             $this->data['text_accept_agree_href_link'] = $content_info['title'];
         } else {
             $this->data['text_accept_agree'] = '';
         }
     } else {
         $this->data['text_accept_agree'] = '';
     }
     if ($this->session->data['payment_method']['id'] != 'no_payment_required') {
         $this->addChild('responses/extension/' . $this->session->data['payment_method']['id'], 'payment');
     } else {
         $this->addChild('responses/checkout/no_payment', 'payment');
     }
     $this->view->batchAssign($this->data);
     $this->processTemplate('pages/checkout/confirm.tpl');
     //init controller data
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }
 public function onControllerPagesCheckoutGuestStep2_InitData()
 {
     $error = false;
     $that = $this->baseObject;
     if (isset($that->request->post['shipping_method'])) {
         $shipping = explode('.', $that->request->post['shipping_method']);
         $that->session->data['shipping_method'] = $that->session->data['shipping_methods'][$shipping[0]]['quote'][$shipping[1]];
     }
     if ($that->request->get['mode'] == 'edit') {
         unset($that->session->data['pp_express_checkout']);
     }
     // if coupon code was submited
     if (has_value($that->request->post['coupon'])) {
         $promotion = new APromotion();
         $coupon = $promotion->getCouponData($that->request->post['coupon']);
         // rebuild order data if coupon applied
         $order = new AOrder(Registry::getInstance());
         $this->data = $order->buildOrderData($that->session->data);
         $order->saveOrder();
         if ($coupon) {
             $that->session->data['coupon'] = $that->request->post['coupon'];
         } else {
             $error = true;
         }
     }
     if (!$error && $that->request->server['REQUEST_METHOD'] == 'POST' && ($that->request->post['payment_method'] == 'default_pp_express' || $that->session->data['payment_method']['id'] == 'default_pp_express')) {
         if (!has_value($that->session->data['pp_express_checkout']['token']) || !has_value($that->session->data['pp_express_checkout']['PayerID'])) {
             // rebuild order data if coupon applied
             $order = new AOrder(Registry::getInstance());
             $this->data = $order->buildOrderData($that->session->data);
             $order->saveOrder();
             $redirect_url = $that->html->getSecureURL('checkout/guest_step_3');
             header('Location: ' . $that->html->getSecureURL('r/extension/default_pp_express/set_pp', '&to_confirm=1&redirect_to=' . urlencode($redirect_url)));
             exit;
         }
     }
 }
Exemple #4
0
 public function post()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     $request = $this->rest->getRequestParams();
     if (!$this->customer->isLoggedWithToken($request['token'])) {
         $this->rest->sendResponse(401, array('error' => 'Not logged in or Login attempt failed!'));
         return null;
     }
     if (!$this->cart->hasProducts()) {
         //No products in the cart.
         $this->rest->sendResponse(200, array('status' => 2, 'error' => 'Nothing in the cart!'));
         return null;
     }
     if (!$this->cart->hasStock() && !$this->config->get('config_stock_checkout')) {
         //No stock for products in the cart if tracked.
         $this->rest->sendResponse(200, array('status' => 3, 'error' => 'No stock for product!'));
         return null;
     }
     if ($this->cart->hasShipping()) {
         if (!isset($this->session->data['shipping_address_id']) || !$this->session->data['shipping_address_id']) {
             //Problem. Missing shipping address
             $this->rest->sendResponse(200, array('status' => 4, 'error' => 'Missing shipping address!'));
             return null;
         }
         if (!isset($this->session->data['shipping_method'])) {
             //Problem. Missing shipping address
             $this->rest->sendResponse(200, array('status' => 5, 'error' => 'Missing shipping method!'));
             return null;
         }
     } else {
         unset($this->session->data['shipping_address_id']);
         unset($this->session->data['shipping_method']);
         unset($this->session->data['shipping_methods']);
         $this->tax->setZone($this->session->data['country_id'], $this->session->data['zone_id']);
     }
     if (!isset($this->session->data['payment_address_id']) || !$this->session->data['payment_address_id']) {
         $this->rest->sendResponse(200, array('status' => 6, 'error' => 'Missing payment (billing) address!'));
         return null;
     }
     if (!isset($this->session->data['payment_method'])) {
         $this->rest->sendResponse(200, array('status' => 5, 'error' => 'Missing payment (billing) method!'));
         return null;
     }
     //build order and pre-save
     $order = new AOrder($this->registry);
     $this->data = $order->buildOrderData($this->session->data);
     $this->session->data['order_id'] = $order->saveOrder();
     //build confirmation data
     $this->loadModel('account/address');
     $shipping_address = $this->model_account_address->getAddress($this->session->data['shipping_address_id']);
     if ($this->cart->hasShipping()) {
         $this->data['shipping_address'] = $this->customer->getFormattedAddress($shipping_address, $shipping_address['address_format']);
     } else {
         $this->data['shipping_address'] = '';
     }
     $this->data['shipping_method'] = $this->session->data['shipping_method']['title'];
     $payment_address = $this->model_account_address->getAddress($this->session->data['payment_address_id']);
     if ($payment_address) {
         $this->data['payment_address'] = $this->customer->getFormattedAddress($payment_address, $payment_address['address_format']);
     } else {
         $this->data['payment_address'] = '';
     }
     if ($this->session->data['payment_method']['id'] != 'no_payment_required') {
         $this->data['payment_method'] = $this->session->data['payment_method']['title'];
     } else {
         $this->data['payment_method'] = '';
     }
     $this->loadModel('tool/seo_url');
     $this->loadModel('tool/image');
     $product_ids = array();
     foreach ($this->data['products'] as $result) {
         $product_ids[] = (int) $result['product_id'];
     }
     $resource = new AResource('image');
     $thumbnails = $resource->getMainThumbList('products', $product_ids, $this->config->get('config_image_cart_width'), $this->config->get('config_image_cart_height'));
     //Format product data specific for confirmation response
     for ($i = 0; $i < sizeof($this->data['products']); $i++) {
         $product_id = $this->data['products'][$i]['product_id'];
         $thumbnail = $thumbnails[$product_id];
         $tax = $this->tax->calcTotalTaxAmount($this->data['products'][$i]['total'], $this->data['products'][$i]['tax_class_id']);
         $this->data['products'][$i] = array_merge($this->data['products'][$i], array('thumb' => $thumbnail['thumb_url'], 'tax' => $this->currency->format($tax), 'price' => $this->currency->format($this->data['products'][$i]['price']), 'total' => $this->currency->format($this->data['products'][$i]['total'])));
     }
     if ($this->config->get('config_checkout_id')) {
         $this->loadModel('catalog/content');
         $content_info = $this->model_catalog_content->getContent($this->config->get('config_checkout_id'));
         if ($content_info) {
             $this->data['text_accept_agree'] = sprintf($this->language->get('text_accept_agree'), '', $content_info['title']);
         } else {
             $this->data['text_accept_agree'] = '';
         }
     } else {
         $this->data['text_accept_agree'] = '';
     }
     // Load selected paymnet required data from payment extension
     if ($this->session->data['payment_method']['id'] != 'no_payment_required') {
         $payment_controller = $this->dispatch('responses/extension/' . $this->session->data['payment_method']['id'] . '/api');
     } else {
         $payment_controller = $this->dispatch('responses/checkout/no_payment/api');
     }
     $this->load->library('json');
     $this->data['payment'] = AJson::decode($payment_controller->dispatchGetOutput(), TRUE);
     //set process_rt for process step to run the payment
     $this->session->data['process_rt'] = $this->data['payment']['process_rt'];
     //mark confirmation viewed
     $this->session->data['confirmed'] = TRUE;
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
     $this->rest->setResponseData($this->data);
     $this->rest->sendResponse(200);
 }
Exemple #5
0
 public function main()
 {
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     if (!$this->cart->hasProducts() || !$this->cart->hasStock() && !$this->config->get('config_stock_checkout')) {
         $this->redirect($this->html->getSecureURL('checkout/cart'));
     }
     //validate if order min/max are met
     if (!$this->cart->hasMinRequirement() || !$this->cart->hasMaxRequirement()) {
         $this->redirect($this->html->getSecureURL('checkout/cart'));
     }
     if (!$this->customer->isLogged()) {
         $this->session->data['redirect'] = $this->html->getSecureURL('checkout/shipping');
         $this->redirect($this->html->getSecureURL('account/login'));
     }
     if ($this->cart->hasShipping()) {
         if (!isset($this->session->data['shipping_address_id']) || !$this->session->data['shipping_address_id']) {
             $this->redirect($this->html->getSecureURL('checkout/shipping'));
         }
         if (!isset($this->session->data['shipping_method'])) {
             $this->redirect($this->html->getSecureURL('checkout/shipping'));
         }
     } else {
         unset($this->session->data['shipping_address_id']);
         unset($this->session->data['shipping_method']);
         unset($this->session->data['shipping_methods']);
         $this->tax->setZone($this->session->data['country_id'], $this->session->data['zone_id']);
     }
     if (!isset($this->session->data['payment_address_id']) || !$this->session->data['payment_address_id']) {
         $this->redirect($this->html->getSecureURL('checkout/payment'));
     }
     if (!isset($this->session->data['payment_method'])) {
         $this->redirect($this->html->getSecureURL('checkout/payment'));
     }
     if ($this->request->get['balance'] == 'disapply') {
         unset($this->session->data['used_balance'], $this->request->get['balance'], $this->session->data['used_balance_full']);
     }
     $this->data = array();
     $order = new AOrder($this->registry);
     $this->data = $order->buildOrderData($this->session->data);
     $order_id = $order->saveOrder();
     if ($order_id === false) {
         // preventing rebuilding order of already processed orders
         //(by "back" button via browser history from external payment page(paypal, google_checkout etc))
         $this->redirect($this->html->getSecureURL('checkout/success'));
     }
     $this->session->data['order_id'] = $order_id;
     $this->document->setTitle($this->language->get('heading_title'));
     $this->document->resetBreadcrumbs();
     $this->document->addBreadcrumb(array('href' => $this->html->getURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE));
     $this->document->addBreadcrumb(array('href' => $this->html->getURL('checkout/cart'), 'text' => $this->language->get('text_basket'), 'separator' => $this->language->get('text_separator')));
     if ($this->cart->hasShipping()) {
         $this->document->addBreadcrumb(array('href' => $this->html->getURL('checkout/shipping'), 'text' => $this->language->get('text_shipping'), 'separator' => $this->language->get('text_separator')));
     }
     $this->document->addBreadcrumb(array('href' => $this->html->getURL('checkout/payment', '&mode=edit', true), 'text' => $this->language->get('text_payment'), 'separator' => $this->language->get('text_separator')));
     $this->document->addBreadcrumb(array('href' => $this->html->getURL('checkout/confirm'), 'text' => $this->language->get('text_confirm'), 'separator' => $this->language->get('text_separator')));
     $this->data['error_warning'] = $this->error['warning'];
     $this->data['success'] = $this->session->data['success'];
     if (isset($this->session->data['success'])) {
         unset($this->session->data['success']);
     }
     //balance
     $balance_def_currency = $this->customer->getBalance();
     $balance = $this->currency->convert($balance_def_currency, $this->config->get('config_currency'), $this->session->data['currency']);
     if ($balance != 0 || $balance == 0 && $this->config->get('config_zero_customer_balance') && (double) $this->session->data['used_balance'] != 0) {
         $this->data['balance'] = $this->language->get('text_balance_checkout') . ' ' . $this->currency->format($balance, $this->session->data['currency'], 1);
         if ((double) $this->session->data['used_balance'] > 0) {
             $this->data['disapply_balance'] = array('href' => $this->html->getSecureURL('checkout/payment', '&mode=edit&balance=disapply', true), 'text' => $this->language->get('button_disapply_balance'));
             $this->data['balance'] .= ' (' . $this->currency->format($balance_def_currency - (double) $this->session->data['used_balance']) . ')';
             $this->data['balance'] .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $this->currency->format((double) $this->session->data['used_balance']) . ' ' . $this->language->get('text_applied_balance');
         } elseif ((double) $this->session->data['used_balance'] == 0 && $balance > 0) {
             $this->data['disapply_balance'] = array('href' => $this->html->getSecureURL('checkout/payment', '&mode=edit&balance=apply', true), 'text' => $this->language->get('button_apply_balance'));
         }
     }
     $this->loadModel('account/address');
     $shipping_address = $this->model_account_address->getAddress($this->session->data['shipping_address_id']);
     if ($this->cart->hasShipping()) {
         $this->data['shipping_address'] = $this->customer->getFormatedAdress($shipping_address, $shipping_address['address_format']);
     } else {
         $this->data['shipping_address'] = '';
     }
     $this->data['shipping_method'] = $this->session->data['shipping_method']['title'];
     $this->data['shipping_method_price'] = $this->session->data['shipping_method']['title'];
     $this->data['checkout_shipping_edit'] = $this->html->getSecureURL('checkout/shipping', '&mode=edit', true);
     $this->data['checkout_shipping_address'] = $this->html->getSecureURL('checkout/address/shipping');
     $payment_address = $this->model_account_address->getAddress($this->session->data['payment_address_id']);
     if ($payment_address) {
         $this->data['payment_address'] = $this->customer->getFormatedAdress($payment_address, $payment_address['address_format']);
     } else {
         $this->data['payment_address'] = '';
     }
     if ($this->session->data['payment_method']['id'] != 'no_payment_required') {
         $this->data['payment_method'] = $this->session->data['payment_method']['title'];
     } else {
         $this->data['payment_method'] = '';
     }
     $this->data['checkout_payment_edit'] = $this->html->getSecureURL('checkout/payment', '&mode=edit', true);
     $this->data['checkout_payment_address'] = $this->html->getSecureURL('checkout/address/payment');
     $this->loadModel('tool/seo_url');
     $this->loadModel('tool/image');
     //Format product data specific for confirmation page
     $resource = new AResource('image');
     for ($i = 0; $i < sizeof($this->data['products']); $i++) {
         $product_id = $this->data['products'][$i]['product_id'];
         $opts = $this->data['products'][$i]['option'];
         $options = array();
         foreach ($opts as $option) {
             if ($option['element_type'] == 'H') {
                 continue;
             }
             //hide hidden options
             $value = $option['value'];
             // hide binary value for checkbox
             if ($option['element_type'] == 'C' && in_array($value, array(0, 1))) {
                 $value = '';
             }
             $options[] = array('name' => $option['name'], 'value' => $value);
         }
         $this->data['products'][$i]['option'] = $options;
         $thumbnail = $resource->getMainThumb('products', $product_id, (int) $this->config->get('config_image_cart_width'), (int) $this->config->get('config_image_cart_height'), true);
         $tax = $this->tax->calcTotalTaxAmount($this->data['products'][$i]['total'], $this->data['products'][$i]['tax_class_id']);
         $this->data['products'][$i] = array_merge($this->data['products'][$i], array('thumb' => $thumbnail, 'tax' => $this->currency->format($tax), 'price' => $this->currency->format($this->data['products'][$i]['price']), 'total' => $this->currency->format($this->data['products'][$i]['total']), 'href' => $this->html->getSEOURL('product/product', '&product_id=' . $product_id, true)));
     }
     $display_totals = $this->cart->buildTotalDisplay();
     $this->data['totals'] = $display_totals['total_data'];
     $this->data['cart'] = $this->html->getSecureURL('checkout/cart');
     if ($this->config->get('config_checkout_id')) {
         $this->loadModel('catalog/content');
         $content_info = $this->model_catalog_content->getContent($this->config->get('config_checkout_id'));
         if ($content_info) {
             $this->data['text_accept_agree'] = $this->language->get('text_accept_agree');
             $this->data['text_accept_agree_href'] = $this->html->getSEOURL('r/content/content/loadInfo', '&content_id=' . $this->config->get('config_checkout_id'), true);
             $this->data['text_accept_agree_href_link'] = $content_info['title'];
         } else {
             $this->data['text_accept_agree'] = '';
         }
     } else {
         $this->data['text_accept_agree'] = '';
     }
     if ($this->session->data['payment_method']['id'] != 'no_payment_required') {
         $this->addChild('responses/extension/' . $this->session->data['payment_method']['id'], 'payment');
     } else {
         $this->addChild('responses/checkout/no_payment', 'payment');
     }
     $this->view->batchAssign($this->data);
     $this->processTemplate('pages/checkout/confirm.tpl');
     //update data before render
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
 }