Exemple #1
0
     } else {
     }
     $languages_query = xos_db_query("select name from " . TABLE_LANGUAGES . " where use_in_id > '1' and languages_id = '" . $order->info['language_id'] . "'");
     if (!xos_db_num_rows($languages_query)) {
         $lang_query = xos_db_query("select name from " . TABLE_LANGUAGES . " where code = '" . xos_db_input(DEFAULT_LANGUAGE) . "'");
         $languages = xos_db_fetch_array($lang_query);
     } else {
         $languages = xos_db_fetch_array($languages_query);
     }
     if (SEND_EMAILS == 'true') {
         $smarty->assign(array('send_emails' => true, 'checkbox_notify' => xos_draw_checkbox_field('notify', '', true), 'checkbox_notify_comments' => xos_draw_checkbox_field('notify_comments', '', true)));
     }
     if (sizeof($order->info['tax_groups']) > 1) {
         $smarty->assign('tax_groups', true);
     }
     $smarty->assign(array('order_id' => $oID, 'order_language_name' => $languages['name'], 'date_purchased' => xos_datetime_short($order->info['date_purchased']), 'customer_address' => xos_address_format($order->customer['format_id'], $order->customer, 1, '', '<br />'), 'delivery_address' => xos_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br />'), 'billing_address' => xos_address_format($order->billing['format_id'], $order->billing, 1, '', '<br />'), 'c_id' => $order->customer['c_id'], 'telephone_number' => $order->customer['telephone'], 'email_address' => $order->customer['email_address'], 'payment_method' => $order->info['payment_method'], 'order_products' => $order_products_array, 'order_totals' => $order_totals_array, 'form_begin_status' => xos_draw_form('new_status', FILENAME_ORDERS, xos_get_all_get_params(array('action')) . 'action=update_order'), 'textarea_comments' => xos_draw_textarea_field('comments', '60', '5'), 'pull_down_status' => xos_draw_pull_down_menu('status', $orders_statuses, $order->info['orders_status']), 'form_end' => '</form>', 'link_filename_orders_invoice' => xos_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $_GET['oID']), 'link_filename_orders_packingslip' => xos_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $_GET['oID']), 'link_filename_orders' => xos_href_link(FILENAME_ORDERS, xos_get_all_get_params(array('action'))), 'edit' => true));
 } else {
     $orders_statuses = array();
     $orders_status_query = xos_db_query("select orders_status_id, orders_status_name from " . TABLE_ORDERS_STATUS . " where language_id = '" . (int) $_SESSION['used_lng_id'] . "'");
     while ($orders_status = xos_db_fetch_array($orders_status_query)) {
         $orders_statuses[] = array('id' => $orders_status['orders_status_id'], 'text' => $orders_status['orders_status_name']);
     }
     $status = $_GET['status'];
     if (isset($_GET['cID'])) {
         $cID = xos_db_prepare_input($_GET['cID']);
         $orders_query_raw = "select o.orders_id, o.customers_name, o.customers_id, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, s.orders_status_code, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . (int) $cID . "' and o.orders_status = s.orders_status_id and s.language_id = '" . (int) $_SESSION['used_lng_id'] . "' and ot.class = 'ot_total' group by o.orders_id order by o.orders_id DESC";
     } elseif (isset($_GET['status']) && is_numeric($_GET['status']) && $_GET['status'] > 0) {
         $status = xos_db_prepare_input($_GET['status']);
         $orders_query_raw = "select o.orders_id, o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, s.orders_status_code, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int) $_SESSION['used_lng_id'] . "' and s.orders_status_id = '" . (int) $status . "' and ot.class = 'ot_total' group by o.orders_id order by o.orders_id DESC";
     } else {
         $orders_query_raw = "select o.orders_id, o.customers_name, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, s.orders_status_code, ot.text as order_total from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id), " . TABLE_ORDERS_STATUS . " s where o.orders_status = s.orders_status_id and s.language_id = '" . (int) $_SESSION['used_lng_id'] . "' and ot.class = 'ot_total' group by o.orders_id order by o.orders_id DESC";
    $order_totals_array = array();
    for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) {
        $order_totals_array[] = array('totals_title' => $order->totals[$i]['title'], 'totals_text' => $order->totals[$i]['text'], 'totals_tax' => $order->totals[$i]['class'] == 'ot_shipping' || $order->totals[$i]['class'] == 'ot_loworderfee' || $order->totals[$i]['class'] == 'ot_cod_fee' ? xos_display_tax_value($order->totals[$i]['tax']) : -1);
    }
    $statuses_query = xos_db_query("select os.orders_status_name, osh.date_added, osh.comments from " . TABLE_ORDERS_STATUS . " os, " . TABLE_ORDERS_STATUS_HISTORY . " osh where osh.orders_id = '" . (int) $_GET['order_id'] . "' and osh.orders_status_id = os.orders_status_id and os.language_id = '" . (int) $_SESSION['languages_id'] . "' and os.public_flag = '1' order by osh.date_added, osh.orders_status_history_id");
    $statuses_array = array();
    while ($statuses = xos_db_fetch_array($statuses_query)) {
        $statuses_array[] = array('order_date_added' => xos_date_short($statuses['date_added']), 'order_status_name' => $statuses['orders_status_name'], 'order_comments' => empty($statuses['comments']) ? '&nbsp;' : nl2br(xos_output_string_protected($statuses['comments'])));
    }
    $back = sizeof($_SESSION['navigation']->path) - 2;
    if (!empty($_SESSION['navigation']->path[$back])) {
        $get_params_array = $_SESSION['navigation']->path[$back]['get'];
        $get_params_array['rmp'] = '0';
        $back_link = xos_href_link($_SESSION['navigation']->path[$back]['page'], xos_array_to_query_string($get_params_array, array('action', xos_session_name())), $_SESSION['navigation']->path[$back]['mode']);
    } else {
        $back_link = 'javascript:history.go(-1)';
    }
    $smarty->assign(array('order_id' => $_GET['order_id'], 'orders_status' => $order->info['orders_status'], 'date_purchased' => xos_date_long($order->info['date_purchased']), 'order_total' => $order->info['total'], 'order_products' => $order_products_array, 'billing_address' => xos_address_format($order->billing['format_id'], $order->billing, 1, ' ', '<br />'), 'payment_method' => $order->info['payment_method'], 'order_totals' => $order_totals_array, 'statuses' => $statuses_array, 'link_back' => $back_link));
    $smarty->configLoad('languages/' . $_SESSION['language'] . '.conf', 'account_history_info');
    $language_directory_query = xos_db_query("select directory from " . TABLE_LANGUAGES . " where use_in_id > '1' and directory = '" . $order->info['language_directory'] . "'");
    if (xos_db_num_rows($language_directory_query)) {
        $smarty->configLoad('languages/' . $order->info['language_directory'] . '.conf', 'order_info');
    }
    if (DOWNLOAD_ENABLED == 'true') {
        include DIR_WS_MODULES . 'downloads.php';
    }
    $output_account_history_info = $smarty->fetch(SELECTED_TPL . '/account_history_info.tpl');
    $smarty->assign('central_contents', $output_account_history_info);
    $smarty->display(SELECTED_TPL . '/frame.tpl');
    require DIR_WS_INCLUDES . 'application_bottom.php';
}
<?php

$oID = xos_db_prepare_input($_GET['oID']);
$orders_query = xos_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . (int) $oID . "'");
include DIR_WS_CLASSES . 'order.php';
$order = new order($oID);
$javascript = '<script type="text/javascript">' . "\n" . '/* <![CDATA[ */' . "\n" . 'function resize() {' . "\n" . '  window.resizeTo(900, 750);' . "\n" . '   self.focus();' . "\n" . '}' . "\n" . '/* ]]> */' . "\n" . '</script>' . "\n";
require DIR_WS_INCLUDES . 'html_header.php';
$order_products_array = array();
for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
    if (isset($order->products[$i]['attributes']) && sizeof($order->products[$i]['attributes']) > 0) {
        $order_attributes_array = array();
        for ($j = 0, $k = sizeof($order->products[$i]['attributes']); $j < $k; $j++) {
            $order_attributes_array[] = array('option_name' => $order->products[$i]['attributes'][$j]['option'], 'option_value_name' => $order->products[$i]['attributes'][$j]['value']);
        }
    }
    $order_products_array[] = array('qty' => $order->products[$i]['qty'], 'model' => $order->products[$i]['model'], 'name' => $order->products[$i]['name'], 'packaging_unit' => $order->products[$i]['packaging_unit'], 'product_attributes' => $order_attributes_array);
    unset($order_attributes_array);
}
$smarty->assign(array('store_name_address' => nl2br(STORE_NAME_ADDRESS), 'shop_logo' => xos_image(DIR_WS_CATALOG_IMAGES . 'catalog/templates/' . DEFAULT_TPL . '/shop_logo.gif', STORE_NAME), 'customer_address' => xos_address_format($order->customer['format_id'], $order->customer, 1, '', '<br />'), 'delivery_address' => xos_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br />'), 'billing_address' => xos_address_format($order->billing['format_id'], $order->billing, 1, '', '<br />'), 'o_id' => $oID, 'c_id' => $order->customer['c_id'], 'customer_telephone' => $order->customer['telephone'], 'customer_email_address' => $order->customer['email_address'], 'payment_method' => $order->info['payment_method'], 'order_products' => $order_products_array));
$smarty->configLoad('languages/' . $_SESSION['language'] . '.conf', 'packingslip');
$language_directory_query = xos_db_query("select directory from " . TABLE_LANGUAGES . " where use_in_id > '1' and directory = '" . $order->info['language_directory'] . "'");
if (xos_db_num_rows($language_directory_query)) {
    $smarty->configLoad(DIR_FS_SMARTY . 'catalog/languages/' . $order->info['language_directory'] . '.conf', 'order_info');
}
$smarty->display(ADMIN_TPL . '/packingslip.tpl');
return 'overwrite_all';
 if ($messageStack->size('checkout_address') > 0) {
     $smarty->assign('message_stack', $messageStack->output('checkout_address'));
     $smarty->assign('message_stack_error', $messageStack->output('checkout_address', 'error'));
     $smarty->assign('message_stack_warning', $messageStack->output('checkout_address', 'warning'));
     $smarty->assign('message_stack_success', $messageStack->output('checkout_address', 'success'));
 }
 if ($process == false) {
     $smarty->assign('address_label', xos_address_label($_SESSION['customer_id'], $_SESSION['billto'], true, ' ', '<br />'));
     if ($addresses_count > 1) {
         $radio_buttons = 0;
         $addresses_query = xos_db_query("select address_book_id, entry_firstname as firstname, entry_lastname as lastname, entry_company as company, entry_street_address as street_address, entry_suburb as suburb, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int) $_SESSION['customer_id'] . "'");
         $addresses_array = array();
         while ($addresses = xos_db_fetch_array($addresses_query)) {
             $format_id = xos_get_address_format_id($addresses['country_id']);
             $addresses['address_book_id'] == $_SESSION['billto'] ? $actual_address = true : ($actual_address = false);
             $addresses_array[] = array('radio_field' => xos_draw_radio_field('address', $addresses['address_book_id'], $addresses['address_book_id'] == $_SESSION['billto'], 'id="address_' . $radio_buttons . '"'), 'actual_address' => $actual_address, 'address_name' => xos_output_string_protected($addresses['firstname'] . ' ' . $addresses['lastname']), 'full_address' => xos_address_format($format_id, $addresses, true, ' ', ', '), 'radio_select' => $radio_buttons);
             $radio_buttons++;
         }
         $smarty->assign(array('several_addresses' => true, 'addresses' => $addresses_array));
     }
 }
 if ($addresses_count < MAX_ADDRESS_BOOK_ENTRIES) {
     $smarty->assign('not_max_address_book_entries', true);
 }
 if ($process == true) {
     $smarty->assign(array('process' => true, 'link_filename_checkout_payment_address' => xos_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL')));
 }
 $smarty->assign(array('form_begin' => xos_draw_form('checkout_address', xos_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL'), 'post', 'onsubmit="return true;"', true), 'form_end' => '</form>', 'hidden_field_submit' => xos_draw_hidden_field('action', 'submit'), 'link_filename_checkout_shipping' => xos_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')));
 $smarty->configLoad('languages/' . $_SESSION['language'] . '.conf', 'checkout_payment_address');
 $output_checkout_payment_address = $smarty->fetch(SELECTED_TPL . '/checkout_payment_address.tpl');
 $smarty->assign('central_contents', $output_checkout_payment_address);
Exemple #5
0
function xos_address_label($customers_id, $address_id = 1, $html = false, $boln = '', $eoln = "\n")
{
    if (is_array($address_id) && !empty($address_id)) {
        return xos_address_format($address_id['address_format_id'], $address_id, $html, $boln, $eoln);
    }
    $address_query = xos_db_query("select entry_firstname as firstname, entry_lastname as lastname, entry_company as company, entry_street_address as street_address, entry_suburb as suburb, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int) $customers_id . "' and address_book_id = '" . (int) $address_id . "'");
    $address = xos_db_fetch_array($address_query);
    $format_id = xos_get_address_format_id($address['country_id']);
    return xos_address_format($format_id, $address, $html, $boln, $eoln);
}
     $_SESSION['navigation']->set_snapshot();
     xos_redirect(xos_href_link(FILENAME_LOGIN, '', 'SSL'));
 }
 require DIR_FS_SMARTY . 'catalog/languages/' . $_SESSION['language'] . '/' . FILENAME_ADDRESS_BOOK;
 $site_trail->add(NAVBAR_TITLE_1, xos_href_link(FILENAME_ACCOUNT, '', 'SSL'));
 $site_trail->add(NAVBAR_TITLE_2, xos_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL'));
 $add_header = '<script type="text/javascript">' . "\n" . '/* <![CDATA[ */' . "\n" . 'function rowOverEffect(object) {' . "\n" . '  if (object.className == "module-row") object.className = "module-row-over";' . "\n" . '}' . "\n\n" . 'function rowOutEffect(object) {' . "\n" . '  if (object.className == "module-row-over") object.className = "module-row";' . "\n" . '}' . "\n" . '/* ]]> */' . "\n" . '</script> ' . "\n";
 require DIR_WS_INCLUDES . 'html_header.php';
 require DIR_WS_INCLUDES . 'boxes.php';
 require DIR_WS_INCLUDES . 'header.php';
 require DIR_WS_INCLUDES . 'footer.php';
 $addresses_query = xos_db_query("select address_book_id, entry_firstname as firstname, entry_lastname as lastname, entry_company as company, entry_street_address as street_address, entry_suburb as suburb, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int) $_SESSION['customer_id'] . "' order by firstname, lastname");
 $addresses_array = array();
 while ($addresses = xos_db_fetch_array($addresses_query)) {
     $format_id = xos_get_address_format_id($addresses['country_id']);
     $addresses_array[] = array('name' => xos_output_string_protected($addresses['firstname'] . ' ' . $addresses['lastname']), 'primary_address' => $addresses['address_book_id'] == $_SESSION['customer_default_address_id'] ? true : false, 'link_filename_address_book_process_edit' => xos_href_link(FILENAME_ADDRESS_BOOK_PROCESS, 'edit=' . $addresses['address_book_id'], 'SSL'), 'link_filename_address_book_process_delete' => xos_href_link(FILENAME_ADDRESS_BOOK_PROCESS, 'delete=' . $addresses['address_book_id'], 'SSL'), 'format_address' => xos_address_format($format_id, $addresses, true, ' ', '<br />'), 'order_total' => $orders['order_total']);
 }
 if (xos_count_customer_address_book_entries() < MAX_ADDRESS_BOOK_ENTRIES) {
     $smarty->assign('link_filename_address_book_process', xos_href_link(FILENAME_ADDRESS_BOOK_PROCESS, '', 'SSL'));
 }
 if ($messageStack->size('addressbook') > 0) {
     $smarty->assign('message_stack', $messageStack->output('addressbook'));
     $smarty->assign('message_stack_error', $messageStack->output('addressbook', 'error'));
     $smarty->assign('message_stack_warning', $messageStack->output('addressbook', 'warning'));
     $smarty->assign('message_stack_success', $messageStack->output('addressbook', 'success'));
 }
 $smarty->assign(array('addresses' => $addresses_array, 'primary_address_label' => xos_address_label($_SESSION['customer_id'], $_SESSION['customer_default_address_id'], true, ' ', '<br />'), 'link_filename_account' => xos_href_link(FILENAME_ACCOUNT, '', 'SSL'), 'max_address_book_entries' => MAX_ADDRESS_BOOK_ENTRIES));
 $smarty->configLoad('languages/' . $_SESSION['language'] . '.conf', 'address_book');
 $output_address_book = $smarty->fetch(SELECTED_TPL . '/address_book.tpl');
 $smarty->assign('central_contents', $output_address_book);
 $smarty->display(SELECTED_TPL . '/frame.tpl');
    if (is_array($payment_modules->modules)) {
        if ($confirmation = $payment_modules->confirmation()) {
            $confirmation_fields_array = array();
            for ($i = 0, $n = sizeof($confirmation['fields']); $i < $n; $i++) {
                $confirmation_fields_array[] = array('title' => $confirmation['fields'][$i]['title'], 'field' => $confirmation['fields'][$i]['field']);
            }
            $smarty->assign(array('confirmation' => true, 'confirmation_title' => $confirmation['title'], 'confirmation_fields' => $confirmation_fields_array));
        }
    }
    if (xos_not_null($order->info['comments'])) {
        $smarty->assign(array('comments' => nl2br(xos_output_string_protected($order->info['comments'])), 'hidden_field_comments' => xos_draw_hidden_field('comments', $order->info['comments'])));
    }
    if (isset(${$_SESSION['payment']}->form_action_url)) {
        $form_action_url = ${$_SESSION['payment']}->form_action_url;
    } else {
        $form_action_url = xos_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');
    }
    if (is_array($payment_modules->modules)) {
        $smarty->assign('input_process_button', $payment_modules->process_button());
    }
    if (sizeof($tax_rates) > 1 && $_SESSION['sppc_customer_group_tax_exempt'] != '1') {
        $smarty->assign('tax_groups', true);
    }
    $popup_status_query = xos_db_query("select status from " . TABLE_CONTENTS . "  where type = 'system_popup' and status = '1' and content_id = '8' LIMIT 1");
    $smarty->assign(array('form_begin' => xos_draw_form('checkout_confirmation', $form_action_url, 'post', 'onsubmit="return check_form();"'), 'form_end' => '</form>', 'link_filename_popup_content_8' => xos_db_num_rows($popup_status_query) ? xos_href_link(FILENAME_POPUP_CONTENT, 'co=8', $request_type) : '', 'order_products' => $order_products_array, 'billing_address' => xos_address_format($order->billing['format_id'], $order->billing, 1, ' ', '<br />'), 'payment_method' => $order->info['payment_method'], 'link_filename_shopping_cart' => xos_href_link(FILENAME_SHOPPING_CART), 'link_filename_checkout_payment_address' => xos_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL'), 'link_filename_checkout_payment' => xos_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'), 'link_filename_checkout_shipping' => xos_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'), 'order_totals' => $order_totals_array));
    $smarty->configLoad('languages/' . $_SESSION['language'] . '.conf', 'checkout_confirmation');
    $output_checkout_confirmation = $smarty->fetch(SELECTED_TPL . '/checkout_confirmation.tpl');
    $smarty->assign('central_contents', $output_checkout_confirmation);
    $smarty->display(SELECTED_TPL . '/frame.tpl');
    require DIR_WS_INCLUDES . 'application_bottom.php';
}