// include boxes require DIR_FS_CATALOG . 'templates/' . CURRENT_TEMPLATE . '/source/boxes.php'; // include needed functions require_once DIR_FS_INC . 'xtc_address_label.inc.php'; require_once DIR_FS_INC . 'xtc_get_country_name.inc.php'; require_once DIR_FS_INC . 'xtc_count_customer_address_book_entries.inc.php'; if (!isset($_SESSION['customer_id'])) { xtc_redirect(xtc_href_link(FILENAME_LOGIN, '', 'SSL')); } $breadcrumb->add(NAVBAR_TITLE_1_ADDRESS_BOOK, xtc_href_link(FILENAME_ACCOUNT, '', 'SSL')); $breadcrumb->add(NAVBAR_TITLE_2_ADDRESS_BOOK, xtc_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL')); require DIR_WS_INCLUDES . 'header.php'; if ($messageStack->size('addressbook') > 0) { $smarty->assign('error', $messageStack->output('addressbook')); } $smarty->assign('ADDRESS_DEFAULT', xtc_address_label($_SESSION['customer_id'], $_SESSION['customer_default_address_id'], true, ' ', '<br />')); $addresses_data = array(); $addresses_query = xtc_db_query("select address_book_id,\n entry_firstname as firstname,\n entry_lastname as lastname,\n entry_company as company,\n entry_street_address as street_address,\n entry_suburb as suburb,\n entry_city as city,\n entry_postcode as postcode,\n entry_state as state,\n entry_zone_id as zone_id,\n entry_country_id as country_id \n from " . TABLE_ADDRESS_BOOK . " \n where customers_id = '" . (int) $_SESSION['customer_id'] . "'\n order by firstname, lastname"); while ($addresses = xtc_db_fetch_array($addresses_query)) { $format_id = xtc_get_address_format_id($addresses['country_id']); if ($addresses['address_book_id'] == $_SESSION['customer_default_address_id']) { $primary = 1; } else { $primary = 0; } $addresses_data[] = array('NAME' => $addresses['firstname'] . ' ' . $addresses['lastname'], 'BUTTON_EDIT' => '<a href="' . xtc_href_link(FILENAME_ADDRESS_BOOK_PROCESS, 'edit=' . $addresses['address_book_id'], 'SSL') . '">' . xtc_image_button('small_edit.gif', SMALL_IMAGE_BUTTON_EDIT) . '</a>', 'BUTTON_DELETE' => '<a href="' . xtc_href_link(FILENAME_ADDRESS_BOOK_PROCESS, 'delete=' . $addresses['address_book_id'], 'SSL') . '">' . xtc_image_button('small_delete.gif', SMALL_IMAGE_BUTTON_DELETE) . '</a>', 'ADDRESS' => xtc_address_format($format_id, $addresses, true, ' ', '<br />'), 'PRIMARY' => $primary); } $smarty->assign('addresses_data', $addresses_data); $smarty->assign('BUTTON_BACK', '<a href="' . xtc_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . xtc_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'); if (xtc_count_customer_address_book_entries() < MAX_ADDRESS_BOOK_ENTRIES) { $smarty->assign('BUTTON_NEW', '<a href="' . xtc_href_link(FILENAME_ADDRESS_BOOK_PROCESS, '', 'SSL') . '">' . xtc_image_button('button_add_address.gif', IMAGE_BUTTON_ADD_ADDRESS) . '</a>');
$breadcrumb->add(NAVBAR_TITLE_PAYPAL_CHECKOUT, xtc_href_link(FILENAME_PAYPAL_CHECKOUT, '', 'SSL')); require DIR_WS_INCLUDES . 'header.php'; if (SHOW_IP_LOG == 'true') { $smarty->assign('IP_LOG', 'true'); if ($_SERVER['HTTP_X_FORWARDED_FOR']) { $customers_ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $customers_ip = $_SERVER['REMOTE_ADDR']; } $smarty->assign('CUSTOMERS_IP', $customers_ip); } $smarty->assign('FORM_SHIPPING_ACTION', xtc_draw_form('checkout_shipping', xtc_href_link(FILENAME_PAYPAL_CHECKOUT, '', 'SSL')) . xtc_draw_hidden_field('action', 'process')); $smarty->assign('ADDRESS_SHIPPING_LABEL', xtc_address_label($_SESSION['customer_id'], $_SESSION['sendto'], true, ' ', '<br />')); $smarty->assign('BUTTON_CONTINUE', xtc_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE)); $smarty->assign('FORM_END', '</form>'); $smarty->assign('ADDRESS_PAYMENT_LABEL', xtc_address_label($_SESSION['customer_id'], $_SESSION['billto'], true, ' ', '<br />')); if (PAYPAL_EXPRESS_ADDRESS_CHANGE == 'true') { $smarty->assign('BUTTON_SHIPPING_ADDRESS', '<a href="' . xtc_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL') . '">' . xtc_image_button('button_change_address.gif', IMAGE_BUTTON_CHANGE_ADDRESS) . '</a>'); $smarty->assign('BUTTON_PAYMENT_ADDRESS', '<a href="' . xtc_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL') . '">' . xtc_image_button('button_change_address.gif', IMAGE_BUTTON_CHANGE_ADDRESS) . '</a>'); } $module_smarty = new Smarty(); if (xtc_count_shipping_modules() > 0) { $showtax = $_SESSION['customers_status']['customers_status_show_price_tax']; $module_smarty->assign('FREE_SHIPPING', $free_shipping); # free shipping or not... if ($free_shipping == true) { $module_smarty->assign('FREE_SHIPPING_TITLE', FREE_SHIPPING_TITLE); $module_smarty->assign('FREE_SHIPPING_DESCRIPTION', sprintf(FREE_SHIPPING_DESCRIPTION, $xtPrice->xtcFormat(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER, true, 0, true)) . xtc_draw_hidden_field('shipping', 'free_free')); $module_smarty->assign('FREE_SHIPPING_ICON', $quotes[$i]['icon']); } else { $radio_buttons = 0;
} elseif (isset($_GET['delete']) && is_numeric($_GET['delete'])) { $breadcrumb->add(NAVBAR_TITLE_DELETE_ENTRY_ADDRESS_BOOK_PROCESS, xtc_href_link(FILENAME_ADDRESS_BOOK_PROCESS, 'delete=' . $_GET['delete'], 'SSL')); } else { $breadcrumb->add(NAVBAR_TITLE_ADD_ENTRY_ADDRESS_BOOK_PROCESS, xtc_href_link(FILENAME_ADDRESS_BOOK_PROCESS, '', 'SSL')); } require DIR_WS_INCLUDES . 'header.php'; if (isset($_GET['delete']) == false) { $action = xtc_draw_form('addressbook', xtc_href_link(FILENAME_ADDRESS_BOOK_PROCESS, isset($_GET['edit']) ? 'edit=' . $_GET['edit'] : '', 'SSL'), 'post', 'onsubmit="return check_form(addressbook);"'); } $smarty->assign('FORM_ACTION', $action); if ($messageStack->size('addressbook') > 0) { $smarty->assign('error', $messageStack->output('addressbook')); } if (isset($_GET['delete'])) { $smarty->assign('delete', '1'); $smarty->assign('ADDRESS', xtc_address_label($_SESSION['customer_id'], $_GET['delete'], true, ' ', '<br />')); $smarty->assign('BUTTON_BACK', '<a href="' . xtc_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL') . '">' . xtc_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'); $smarty->assign('BUTTON_DELETE', '<a href="' . xtc_href_link(FILENAME_ADDRESS_BOOK_PROCESS, 'delete=' . $_GET['delete'] . '&action=deleteconfirm', 'SSL') . '">' . xtc_image_button('button_delete.gif', IMAGE_BUTTON_DELETE) . '</a>'); } else { include DIR_WS_MODULES . 'address_book_details.php'; if (isset($_GET['edit']) && is_numeric($_GET['edit'])) { $smarty->assign('BUTTON_BACK', '<a href="' . xtc_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL') . '">' . xtc_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'); $smarty->assign('BUTTON_UPDATE', xtc_draw_hidden_field('action', 'update') . xtc_draw_hidden_field('edit', $_GET['edit']) . xtc_image_submit('button_update.gif', IMAGE_BUTTON_UPDATE)); } else { if (sizeof($_SESSION['navigation']->snapshot) > 0) { $back_link = xtc_href_link($_SESSION['navigation']->snapshot['page'], xtc_array_to_string($_SESSION['navigation']->snapshot['get'], array(xtc_session_name())), $_SESSION['navigation']->snapshot['mode']); } else { $back_link = xtc_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL'); } $smarty->assign('BUTTON_BACK', '<a href="' . $back_link . '">' . xtc_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'); $smarty->assign('BUTTON_UPDATE', xtc_draw_hidden_field('action', 'process') . xtc_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE));