function vam_address_summary($customers_id, $address_id) { $customers_id = vam_db_prepare_input($customers_id); $address_id = vam_db_prepare_input($address_id); $address_query = vam_db_query("select ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_state, ab.entry_country_id, ab.entry_zone_id, c.countries_name, c.address_format_id from " . TABLE_ADDRESS_BOOK . " ab, " . TABLE_COUNTRIES . " c where ab.address_book_id = '" . vam_db_input($address_id) . "' and ab.customers_id = '" . vam_db_input($customers_id) . "' and ab.entry_country_id = c.countries_id"); $address = vam_db_fetch_array($address_query); $street_address = $address['entry_street_address']; $suburb = $address['entry_suburb']; $postcode = $address['entry_postcode']; $city = $address['entry_city']; $state = vam_get_zone_name($address['entry_country_id'], $address['entry_zone_id'], $address['entry_state']); $country = $address['countries_name']; $address_format_query = vam_db_query("select address_summary from " . TABLE_ADDRESS_FORMAT . " where address_format_id = '" . $address['address_format_id'] . "'"); $address_format = vam_db_fetch_array($address_format_query); // eval("\$address = \"{$address_format['address_summary']}\";"); $address_summary = $address_format['address_summary']; eval("\$address = \"{$address_summary}\";"); return $address; }
if (vam_db_num_rows($zone) > 0) { $zone_id = $zone['zone_id']; $zone_name = $zone['zone_name']; } else { $zone = vam_db_query("select distinct zone_id, zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int) $entry['entry_country_id'] . "' and zone_code = '" . vam_db_input($state) . "'"); if (vam_db_num_rows($zone) > 0) { $zone_id = $zone['zone_id']; $zone_name = $zone['zone_name']; } } } } if ($entry_state_has_zones == true) { $state_input = vam_draw_pull_down_menuNote(array('name' => 'state', 'text' => ' ' . (vam_not_null(ENTRY_STATE_TEXT) ? '<span class="Requirement">' . ENTRY_STATE_TEXT . '</span>' : '')), $zones_array, vam_get_zone_name($entry['entry_country_id'], $entry['entry_zone_id'], $entry['entry_state']), ' id="state"'); } else { $state_input = vam_draw_input_fieldNote(array('name' => 'state', 'text' => ' ' . (vam_not_null(ENTRY_STATE_TEXT) ? '<span class="Requirement">' . ENTRY_STATE_TEXT . '</span>' : '')), vam_get_zone_name(STORE_COUNTRY, STORE_ZONE), ' id="state"'); } $module->assign('INPUT_STATE', $state_input); } else { $module->assign('state', '0'); } if ($_POST['country']) { $selected = $_POST['country']; } else { $selected = $entry['entry_country_id']; } if (ACCOUNT_COUNTRY == 'true') { $module->assign('country', '1'); if ($process == true) { $entry['entry_country_id'] = (int) $_POST['country']; }
function vam_address_format($address_format_id, $address, $html, $boln, $eoln) { $address_format_query = vam_db_query("select address_format as format from " . TABLE_ADDRESS_FORMAT . " where address_format_id = '" . $address_format_id . "'"); $address_format = vam_db_fetch_array($address_format_query); $company = addslashes($address['company']); $firstname = addslashes($address['firstname']); $secondname = addslashes($address['secondname']); $lastname = addslashes($address['lastname']); $street = addslashes($address['street_address']); $suburb = addslashes($address['suburb']); $city = addslashes($address['city']); $state = addslashes($address['state']); $country_id = $address['country_id']; $zone_id = $address['zone_id']; $postcode = addslashes($address['postcode']); $zip = $postcode; $country = vam_get_country_name($country_id); $state = vam_get_zone_name($country_id, $zone_id, $state); if ($html) { // HTML Mode $HR = '<hr />'; $hr = '<hr />'; if ($boln == '' && $eoln == "\n") { // Values not specified, use rational defaults $CR = '<br />'; $cr = '<br />'; $eoln = $cr; } else { // Use values supplied $CR = $eoln . $boln; $cr = $CR; } } else { // Text Mode $CR = $eoln; $cr = $CR; $HR = '----------------------------------------'; $hr = '----------------------------------------'; } $statecomma = ''; $streets = $street; if ($suburb != '') { $streets = $street . $cr . $suburb; } if ($firstname == '') { $firstname = addslashes($address['name']); } if ($country == '') { $country = addslashes((string) $address['country']); } if ($state != '') { $statecomma = $state . ', '; } $fmt = $address_format['format']; eval("\$address = \"{$fmt}\";"); if (ACCOUNT_COMPANY == 'true' && vam_not_null($company)) { $address = $company . $cr . $address; } $address = stripslashes($address); return $address; }
$zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']); } $zone = vam_db_query("select distinct zone_id, zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int) $country . "' and zone_code = '" . vam_db_input($state) . "'"); if (vam_db_num_rows($zone) > 0) { $zone_id = $zone['zone_id']; $zone_name = $zone['zone_name']; } else { $zone = vam_db_query("select distinct zone_id, zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int) $country . "'"); if (vam_db_num_rows($zone) > 0) { $zone_id = $zone['zone_id']; $zone_name = $zone['zone_name']; } } } if ($entry_state_has_zones == true) { $state_input = vam_draw_pull_down_menuNote(array('name' => 'state', 'text' => ' ' . (vam_not_null(ENTRY_STATE_TEXT) ? '<span class="Requirement">' . ENTRY_STATE_TEXT . '</span>' : '')), $zones_array, $process == true ? $state : vam_get_zone_name(STORE_COUNTRY, STORE_ZONE, ''), ' id="state"'); } else { $state_input = vam_draw_input_fieldNote(array('name' => 'state', 'text' => ' ' . (vam_not_null(ENTRY_STATE_TEXT) ? '<span class="Requirement">' . ENTRY_STATE_TEXT . '</span>' : '')), '', 'id="state"'); } $vamTemplate->assign('INPUT_STATE', $state_input); } else { $vamTemplate->assign('state', '0'); } if ($_POST['country']) { $selected = $_POST['country']; } else { $selected = STORE_COUNTRY; } if (ACCOUNT_COUNTRY == 'true') { $vamTemplate->assign('country', '1'); $vamTemplate->assign('SELECT_COUNTRY', vam_get_country_list(array('name' => 'country', 'text' => ' ' . (vam_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="Requirement">' . ENTRY_COUNTRY_TEXT . '</span>' : '')), $selected, 'id="country"'));
if (isset($_POST['billing_same_as_customer'])) { $_SESSION['billing_same_as_customer'] = $_POST['billing_same_as_customer']; } if (isset($_POST['shipping_same_as_billing'])) { $_SESSION['shipping_same_as_billing'] = $_POST['shipping_same_as_billing']; } // Update Order Info //figure out the new currency value $currency_value_query = vam_db_query("SELECT value \n\t\t FROM " . TABLE_CURRENCIES . " \n\t\t\t\t\t\t\t\t\t\t\t WHERE code = '" . $_POST['update_info_payment_currency'] . "'"); $currency_value = vam_db_fetch_array($currency_value_query); //figure out the country, state $update_customer_state = vam_get_zone_name($_POST['update_customer_country_id'], $_POST['update_customer_zone_id'], $_POST['update_customer_state']); $update_customer_country = vam_get_country_name($_POST['update_customer_country_id']); $update_billing_state = vam_get_zone_name($_POST['update_billing_country_id'], $_POST['update_billing_zone_id'], $_POST['update_billing_state']); $update_billing_country = vam_get_country_name($_POST['update_billing_country_id']); $update_delivery_state = vam_get_zone_name($_POST['update_delivery_country_id'], $_POST['update_delivery_zone_id'], $_POST['update_delivery_state']); $update_delivery_country = vam_get_country_name($_POST['update_delivery_country_id']); $sql_data_array = array('customers_name' => vam_db_input(vam_db_prepare_input($_POST['update_customer_name'])), 'customers_company' => vam_db_input(vam_db_prepare_input($_POST['update_customer_company'])), 'customers_street_address' => vam_db_input(vam_db_prepare_input($_POST['update_customer_street_address'])), 'customers_suburb' => vam_db_input(vam_db_prepare_input($_POST['update_customer_suburb'])), 'customers_city' => vam_db_input(vam_db_prepare_input($_POST['update_customer_city'])), 'customers_state' => vam_db_input(vam_db_prepare_input($update_customer_state)), 'customers_postcode' => vam_db_input(vam_db_prepare_input($_POST['update_customer_postcode'])), 'customers_country' => vam_db_input(vam_db_prepare_input($update_customer_country)), 'customers_telephone' => vam_db_input(vam_db_prepare_input($_POST['update_customer_telephone'])), 'customers_email_address' => vam_db_input(vam_db_prepare_input($_POST['update_customer_email_address'])), 'billing_name' => vam_db_input(vam_db_prepare_input(isset($_POST['billing_same_as_customer']) && $_POST['billing_same_as_customer'] == 'on' ? $_POST['update_customer_name'] : $_POST['update_billing_name'])), 'billing_company' => vam_db_input(vam_db_prepare_input(isset($_POST['billing_same_as_customer']) && $_POST['billing_same_as_customer'] == 'on' ? $_POST['update_customer_company'] : $_POST['update_billing_company'])), 'billing_street_address' => vam_db_input(vam_db_prepare_input(isset($_POST['billing_same_as_customer']) && $_POST['billing_same_as_customer'] == 'on' ? $_POST['update_customer_street_address'] : $_POST['update_billing_street_address'])), 'billing_suburb' => vam_db_input(vam_db_prepare_input(isset($_POST['billing_same_as_customer']) && $_POST['billing_same_as_customer'] == 'on' ? $_POST['update_customer_suburb'] : $_POST['update_billing_suburb'])), 'billing_city' => vam_db_input(vam_db_prepare_input(isset($_POST['billing_same_as_customer']) && $_POST['billing_same_as_customer'] == 'on' ? $_POST['update_customer_city'] : $_POST['update_billing_city'])), 'billing_state' => vam_db_input(vam_db_prepare_input(isset($_POST['billing_same_as_customer']) && $_POST['billing_same_as_customer'] == 'on' ? $update_customer_state : $update_billing_state)), 'billing_postcode' => vam_db_input(vam_db_prepare_input(isset($_POST['billing_same_as_customer']) && $_POST['billing_same_as_customer'] == 'on' ? $_POST['update_customer_postcode'] : $_POST['update_billing_postcode'])), 'billing_country' => vam_db_input(vam_db_prepare_input(isset($_POST['billing_same_as_customer']) && $_POST['billing_same_as_customer'] == 'on' ? $update_customer_country : $update_billing_country)), 'delivery_name' => vam_db_input(vam_db_prepare_input(isset($_POST['shipping_same_as_billing']) && $_POST['shipping_same_as_billing'] == 'on' ? $_POST['billing_same_as_customer'] == 'on' ? $_POST['update_customer_name'] : $_POST['update_billing_name'] : $_POST['update_delivery_name'])), 'delivery_company' => vam_db_input(vam_db_prepare_input(isset($_POST['shipping_same_as_billing']) && $_POST['shipping_same_as_billing'] == 'on' ? $_POST['billing_same_as_customer'] == 'on' ? $_POST['update_customer_company'] : $_POST['update_billing_company'] : $_POST['update_delivery_company'])), 'delivery_street_address' => vam_db_input(vam_db_prepare_input(isset($_POST['shipping_same_as_billing']) && $_POST['shipping_same_as_billing'] == 'on' ? $_POST['billing_same_as_customer'] == 'on' ? $_POST['update_customer_street_address'] : $_POST['update_billing_street_address'] : $_POST['update_delivery_street_address'])), 'delivery_suburb' => vam_db_input(vam_db_prepare_input(isset($_POST['shipping_same_as_billing']) && $_POST['shipping_same_as_billing'] == 'on' ? $_POST['billing_same_as_customer'] == 'on' ? $_POST['update_customer_suburb'] : $_POST['update_billing_suburb'] : $_POST['update_delivery_suburb'])), 'delivery_city' => vam_db_input(vam_db_prepare_input(isset($_POST['shipping_same_as_billing']) && $_POST['shipping_same_as_billing'] == 'on' ? $_POST['billing_same_as_customer'] == 'on' ? $_POST['update_customer_city'] : $_POST['update_billing_city'] : $_POST['update_delivery_city'])), 'delivery_state' => vam_db_input(vam_db_prepare_input(isset($_POST['shipping_same_as_billing']) && $_POST['shipping_same_as_billing'] == 'on' ? $_POST['billing_same_as_customer'] == 'on' ? $update_customer_state : $update_billing_state : $update_delivery_state)), 'delivery_postcode' => vam_db_input(vam_db_prepare_input(isset($_POST['shipping_same_as_billing']) && $_POST['shipping_same_as_billing'] == 'on' ? $_POST['billing_same_as_customer'] == 'on' ? $_POST['update_customer_postcode'] : $_POST['update_billing_postcode'] : $_POST['update_delivery_postcode'])), 'delivery_country' => vam_db_input(vam_db_prepare_input(isset($_POST['shipping_same_as_billing']) && $_POST['shipping_same_as_billing'] == 'on' ? $_POST['billing_same_as_customer'] == 'on' ? $update_customer_country : $update_billing_country : $update_delivery_country)), 'payment_method' => vam_db_input(vam_db_prepare_input($_POST['update_info_payment_method'])), 'currency' => vam_db_input(vam_db_prepare_input($_POST['update_info_payment_currency'])), 'currency_value' => vam_db_input(vam_db_prepare_input($currency_value['value'])), 'cc_type' => vam_db_prepare_input($_POST['update_info_cc_type']), 'cc_owner' => vam_db_prepare_input($_POST['update_info_cc_owner']), 'cc_number' => vam_db_input(vam_db_prepare_input($_POST['update_info_cc_number'])), 'cc_expires' => vam_db_prepare_input($_POST['update_info_cc_expires']), 'last_modified' => 'now()'); vam_db_perform(TABLE_ORDERS, $sql_data_array, 'update', 'orders_id = \'' . vam_db_input($oID) . '\''); $order_updated = true; // UPDATE STATUS HISTORY & SEND EMAIL TO CUSTOMER IF NECESSARY ##### $check_status_query = vam_db_query("\n\t SELECT customers_name, customers_email_address, orders_status, date_purchased \n\t FROM " . TABLE_ORDERS . " \n\t\t\t\t\t\t WHERE orders_id = '" . (int) $oID . "'"); $check_status = vam_db_fetch_array($check_status_query); if ($check_status['orders_status'] != $_POST['status'] || vam_not_null($_POST['comments'])) { vam_db_query("UPDATE " . TABLE_ORDERS . " SET \n\t\t\t\t\t orders_status = '" . vam_db_input($_POST['status']) . "', \n last_modified = now() \n WHERE orders_id = '" . (int) $oID . "'"); // Notify Customer ? $customer_notified = '0'; if (isset($_POST['notify']) && $_POST['notify'] == 'on') { $notify_comments = ''; if (isset($_POST['notify_comments']) && $_POST['notify_comments'] == 'on') { $notify_comments = $_GET['comments'];
j++; } } if (j==0) { document.customers.state.options[0]=new Option('-','-'); } if (reg) { document.customers.state.value = reg; } } var zones = new Array( <?php $zones_query = vam_db_query("select zone_country_id,zone_name from " . TABLE_ZONES . " order by zone_name asc"); $mas = array(); while ($zones_values = vam_db_fetch_array($zones_query)) { $zones[] = 'new Array(' . $zones_values['zone_country_id'] . ',"' . $zones_values['zone_name'] . '")'; } $zones_array1[] = 'new Array(' . $cInfo->entry_country_id . ',"' . vam_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, '') . '")'; $zones = array_merge($zones_array1, $zones); echo implode(',', $zones); ?> ); document.write('<SELECT NAME="state">'); document.write('</SELECT>'); changeselect("<?php echo vam_db_prepare_input($_POST['state']); ?> "); --> </script> </td> </tr> <?php
if (vam_db_num_rows($zone) > 0) { $zone_id = $zone['zone_id']; $zone_name = $zone['zone_name']; } else { $zone = vam_db_query("select distinct zone_id, zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int) $affiliate['affiliate_country_id'] . "' and zone_code = '" . vam_db_input($affiliate['affiliate_zone_id']) . "'"); if (vam_db_num_rows($zone) > 0) { $zone_id = $zone['zone_id']; $zone_name = $zone['zone_name']; } } } } if ($entry_state_has_zones == true) { $state_input = vam_draw_pull_down_menuNote(array('name' => 'a_state', 'text' => ' ' . (defined(ENTRY_STATE_TEXT) ? '<span class="Requirement">' . ENTRY_STATE_TEXT . '</span>' : '')), $zones_array, vam_get_zone_name($affiliate['affiliate_country_id'], $affiliate['affiliate_zone_id'], $affiliate['affiliate_state']), ' id="state"'); } else { $state_input = vam_draw_input_fieldNote(array('name' => 'a_state', 'text' => ' ' . (defined(ENTRY_STATE_TEXT) ? '<span class="Requirement">' . ENTRY_STATE_TEXT . '</span>' : '')), vam_get_zone_name($affiliate['affiliate_country_id'], $affiliate['affiliate_zone_id'], $affiliate['affiliate_state']), ' id="state"'); } $module->assign('state_content', $state_input); } if ($is_read_only == true) { $telephone_content = $affiliate['affiliate_telephone']; } elseif ($error == true) { if ($entry_telephone_error == true) { $telephone_content = vam_draw_input_fieldNote(array('name' => 'a_telephone', 'text' => ' ' . ENTRY_TELEPHONE_NUMBER_ERROR)); } else { $telephone_content = $a_telephone . vam_draw_hidden_field('a_telephone'); } } else { $telephone_content = vam_draw_input_fieldNote(array('name' => 'a_telephone', 'text' => ' ' . ENTRY_TELEPHONE_NUMBER_TEXT), $affiliate['affiliate_telephone']); } $module->assign('telephone_content', $telephone_content);