} elseif ($free_shipping == 1) { echo sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)); } else { ?> <table width="100%" border="1" cellpadding="2" cellspacing="2"> <?php if ($_SESSION['customer_id'] < 1) { ?> <tr> <td colspan="2" class="seDisplayedAddressLabel"> <?php echo CART_SHIPPING_QUOTE_CRITERIA; ?> <br /> <?php echo '<span class="seDisplayedAddressInfo">' . zen_get_zone_name($selected_country, $state_zone_id, '') . ($selectedState != '' ? ' ' . $selectedState : '') . ' ' . $order->delivery['postcode'] . ' ' . zen_get_country_name($order->delivery['country_id']) . '</span>'; ?> </td> </tr> <?php } ?> <tr> <th scope="col" id="seProductsHeading"><?php echo CART_SHIPPING_METHOD_TEXT; ?> </th> <th scope="col" id="seTotalHeading"><?php echo CART_SHIPPING_METHOD_RATES; ?> </th>
/** Echoes out a complete address form, returns nothing. * * You are required to manually put the `form-horizontal` class in the * surrounding `<form>` element. */ public static function echo_shipping_address_form() { global $entry, $zone_name, $zone_id, $flag_show_pulldown_states, $selected_country; ?> <p class="text-danger"><strong><?php echo FORM_REQUIRED_INFORMATION; ?> </strong></p> <?php if (ACCOUNT_GENDER == 'true') { $male = (isset($gender) ? $gender : $entry->fields['entry_gender']) == 'male'; echo '<label class="radio-inline">' . zen_draw_radio_field('gender', 'm', $male, 'id="gender-male"') . MALE . '</label>' . '<label class="radio-inline">' . zen_draw_radio_field('gender', 'f', !$male, 'id="gender-female"') . FEMALE . '</label>' . self::required_text(ENTRY_GENDER_TEXT); } ?> <div class='form-group'> <label class="control-label col-sm-4" for="firstname"><?php echo self::required_text(ENTRY_FIRST_NAME_TEXT) . ENTRY_FIRST_NAME; ?> </label> <div class='col-sm-8'> <?php echo zen_draw_input_field('firstname', $entry->fields['entry_firstname'], zen_set_field_length(TABLE_CUSTOMERS, 'customers_firstname', '40') . ' class="form-control" id="firstname"'); ?> </div> </div> <div class='form-group'> <label class="control-label col-sm-4" for="lastname"><?php echo self::required_text(ENTRY_LAST_NAME_TEXT) . ENTRY_LAST_NAME; ?> </label> <div class='col-sm-8'> <?php echo zen_draw_input_field('lastname', $entry->fields['entry_lastname'], zen_set_field_length(TABLE_CUSTOMERS, 'customers_lastname', '40') . ' class="form-control" id="lastname"'); ?> </div> </div> <?php if (ACCOUNT_COMPANY == 'true') { ?> <div class='form-group'> <label class="control-label col-sm-4" for="lastname"><?php echo self::required_text(ENTRY_COMPANY_TEXT) . ENTRY_COMPANY; ?> </label> <div class='col-sm-8'> <?php echo zen_draw_input_field('company', $entry->fields['entry_company'], zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_company', '40') . ' class="form-control" id="company"'); ?> </div> </div> <?php } ?> <div class='form-group'> <label class="control-label col-sm-4" for="street-address"><?php echo self::required_text(ENTRY_STREET_ADDRESS_TEXT) . ENTRY_STREET_ADDRESS; ?> </label> <div class='col-sm-8'> <?php echo zen_draw_input_field('street_address', $entry->fields['entry_street_address'], zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_street_address', '40') . ' class="form-control" id="street-address"'); ?> </div> </div> <?php if (ACCOUNT_SUBURB == 'true') { ?> <div class='form-group'> <label class="control-label col-sm-4" for="suburb"><?php echo self::required_text(ENTRY_SUBURB_TEXT) . ENTRY_SUBURB; ?> </label> <div class='col-sm-8'> <?php echo zen_draw_input_field('suburb', $entry->fields['entry_suburb'], zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_suburb', '40') . ' class="form-control" id="suburb"'); ?> </div> </div> <?php } ?> <div class='form-group'> <label class="control-label col-sm-4" for="city"><?php echo self::required_text(ENTRY_CITY_TEXT) . ENTRY_CITY; ?> </label> <div class='col-sm-8'> <?php echo zen_draw_input_field('city', $entry->fields['entry_city'], zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_city', '40') . ' class="form-control" id="city"'); ?> </div></div> <?php if (ACCOUNT_STATE == 'true') { if ($flag_show_pulldown_states == true) { ?> <div class='form-group'> <label class="control-label col-sm-4" for="stateZone" class="form-control" id="zoneLabel"> <?php echo self::required_text(ENTRY_STATE_TEXT) . ENTRY_STATE; ?> </label> <div class='col-sm-8'> <?php echo zen_draw_pull_down_menu('zone_id', zen_prepare_country_zones_pull_down($selected_country), $zone_id, 'class="form-control" id="stateZone"'); echo '</div></div>'; } ?> <div class='form-group' id='stateLabel'> <label class="control-label col-sm-4" for="state"><?php echo self::required_text(ENTRY_STATE_TEXT) . ENTRY_STATE; ?> </label> <!-- Elements with ids of `stText` & `stBreak` are required by Zencart, leaving them out breaks the auto-populating of the State dropdown when editing an address. --> <span id='stText'></span><span id='stBreak'></span> <div class='col-sm-8'> <?php echo zen_draw_input_field('state', zen_get_zone_name($entry->fields['entry_country_id'], $entry->fields['entry_zone_id'], $entry->fields['entry_state']), zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_state', '40') . ' class="form-control" id="state"'); if ($flag_show_pulldown_states == false) { echo zen_draw_hidden_field('zone_id', $zone_name, ' '); } ?> </div></div> <?php } ?> <div class='form-group'> <label class="control-label col-sm-4" for="postcode"><?php echo self::required_text(ENTRY_POST_CODE_TEXT) . ENTRY_POST_CODE; ?> </label> <div class='col-sm-8'> <?php echo zen_draw_input_field('postcode', $entry->fields['entry_postcode'], zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_postcode', '40') . ' class="form-control" id="postcode"'); ?> </div></div> <div class='form-group'> <label class="control-label col-sm-4" for="country"><?php echo self::required_text(ENTRY_COUNTRY_TEXT) . ENTRY_COUNTRY; ?> </label> <div class='col-sm-8'> <?php echo zen_get_country_list('zone_country_id', isset($entry->fields['entry_country_id']) ? $entry->fields['entry_country_id'] : $selected_country, 'class="form-control" id="country" ' . ($flag_show_pulldown_states == true ? 'onchange="update_zone(this.form);"' : '')); ?> </div></div><?php }
} $messageStack->add_session('addressbook', SUCCESS_ADDRESS_BOOK_ENTRY_UPDATED, 'success'); zen_redirect(zen_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL')); } } if (isset($_GET['edit']) && is_numeric($_GET['edit'])) { $entry_query = "SELECT entry_gender, entry_company, entry_firstname, entry_lastname,\r\n entry_street_address, entry_suburb, entry_postcode, entry_city,\r\n entry_state, entry_zone_id, entry_country_id\r\n FROM " . TABLE_ADDRESS_BOOK . "\r\n WHERE customers_id = :customersID\r\n AND address_book_id = :addressBookID"; $entry_query = $db->bindVars($entry_query, ':customersID', $_SESSION['customer_id'], 'integer'); $entry_query = $db->bindVars($entry_query, ':addressBookID', $_GET['edit'], 'integer'); $entry = $db->Execute($entry_query); if ($entry->RecordCount() <= 0) { $messageStack->add_session('addressbook', ERROR_NONEXISTING_ADDRESS_BOOK_ENTRY); zen_redirect(zen_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL')); } if (!isset($zone_name) || (int) $zone_name == 0) { $zone_name = zen_get_zone_name($entry->fields['entry_country_id'], $entry->fields['entry_zone_id'], $entry->fields['entry_state']); } if (!isset($zone_id) || (int) $zone_id == 0) { $zone_id = $entry->fields['entry_zone_id']; } } elseif (isset($_GET['delete']) && is_numeric($_GET['delete'])) { if ($_GET['delete'] == $_SESSION['customer_default_address_id']) { $messageStack->add_session('addressbook', WARNING_PRIMARY_ADDRESS_DELETION, 'warning'); zen_redirect(zen_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL')); } else { $check_query = "SELECT count(*) AS total\r\n FROM " . TABLE_ADDRESS_BOOK . "\r\n WHERE address_book_id = :addressBookID\r\n AND customers_id = :customersID"; $check_query = $db->bindVars($check_query, ':customersID', $_SESSION['customer_id'], 'integer'); $check_query = $db->bindVars($check_query, ':addressBookID', $_GET['delete'], 'integer'); $check = $db->Execute($check_query); if ($check->fields['total'] < 1) { $messageStack->add_session('addressbook', ERROR_NONEXISTING_ADDRESS_BOOK_ENTRY);
<?php if ($flag_show_pulldown_states == true) { ?> <?php } ?> <label class="inputLabel" for="state" id="stateLabel"> <?php echo ENTRY_STATE; ?> <?php echo zen_not_null(ENTRY_STATE_TEXT) ? '<span class="alert-text">' . ENTRY_STATE_TEXT . '</span>' : ''; ?> </label> <?php echo zen_draw_input_field('state', zen_get_zone_name($entry->fields['entry_country_id'], $entry->fields['entry_zone_id'], $entry->fields['entry_state']), zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_state', '40') . ' id="state"'); if ($flag_show_pulldown_states == false) { echo zen_draw_hidden_field('zone_id', $zone_name, ' '); } ?> <br class="clearBoth" /> <?php } ?> <label class="inputLabel" for="postcode"> <?php echo ENTRY_POST_CODE; ?> <?php echo zen_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="alert-text">' . ENTRY_POST_CODE_TEXT . '</span>' : ''; ?>
<?php global $gBitCustomer, $gCommerceSystem; if (empty($_template->tpl_vars['address']->value['country_id'])) { $_template->tpl_vars['address']->value['country_id'] = defined('STORE_COUNTRY') ? STORE_COUNTRY : NULL; } if ($gCommerceSystem->isConfigActive('ACCOUNT_STATE')) { if (!empty($_template->tpl_vars['address']->value['country_id'])) { if (!($stateInput = zen_get_country_zone_list('state', $_template->tpl_vars['address']->value['country_id'], !empty($_template->tpl_vars['address']->value['entry_zone_id']) ? $_template->tpl_vars['address']->value['entry_zone_id'] : ''))) { $stateInput = zen_draw_input_field('state', zen_get_zone_name($_template->tpl_vars['address']->value['country_id'], $_template->tpl_vars['address']->value['entry_zone_id'], $_template->tpl_vars['address']->value['entry_state'])); } } else { $stateInput = zen_draw_input_field('state'); } $_template->tpl_vars['stateInput'] = new Smarty_Variable($stateInput); } $_template->tpl_vars['countryPullDown'] = new Smarty_Variable(zen_get_country_list('country_id', $_template->tpl_vars['address']->value['country_id'], ' onchange="updateStates(this.value)" ')); if (isset($_GET['edit']) && $_SESSION['customer_default_address_id'] != $_GET['edit'] || isset($_GET['edit']) == false) { $gBitSmarty->assign('primaryCheck', TRUE); }
function getStateInputHtml($pAddressHash) { global $gCommerceSystem; $stateInput = ''; if (!($selectedCountry = BitBase::getIdParameter($pAddressHash, 'country_id'))) { if (!($selectedCountry = BitBase::getIdParameter($pAddressHash, 'entry_country_id'))) { $selectedCountry = defined('STORE_COUNTRY') ? STORE_COUNTRY : NULL; } } if ($gCommerceSystem->isConfigActive('ACCOUNT_STATE')) { if (!empty($selectedCountry)) { if (!($stateInput = zen_get_country_zone_list('state', $selectedCountry, !empty($pAddressHash['entry_zone_id']) ? $pAddressHash['entry_zone_id'] : ''))) { $stateInput = zen_draw_input_field('state', zen_get_zone_name($selectedCountry, $pAddressHash['entry_zone_id'], $pAddressHash['entry_state'])); } } else { $stateInput = zen_draw_input_field('state'); } } return $stateInput; }
if ($entry_state_has_zones == true) { $zones_array = array(); $zones_values = $db->Execute("select zone_name\n from " . TABLE_ZONES . "\n where zone_country_id = '" . zen_db_input($cInfo->entry_country_id) . "'\n order by zone_name"); while (!$zones_values->EOF) { $zones_array[] = array('id' => $zones_values->fields['zone_name'], 'text' => $zones_values->fields['zone_name']); $zones_values->MoveNext(); } echo zen_draw_pull_down_menu('entry_state', $zones_array) . ' ' . ENTRY_STATE_ERROR; } else { echo zen_draw_input_field('entry_state', htmlspecialchars(zen_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state), ENT_COMPAT, CHARSET, TRUE)) . ' ' . ENTRY_STATE_ERROR; } } else { echo $entry_state . zen_draw_hidden_field('entry_zone_id') . zen_draw_hidden_field('entry_state'); } } else { echo zen_draw_input_field('entry_state', htmlspecialchars(zen_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state), ENT_COMPAT, CHARSET, TRUE)); } ?> </td> </tr> <?php } ?> <tr> <td class="main"><?php echo ENTRY_COUNTRY; ?> </td> <td class="main"> <?php if ($error == true) {
if (ACCOUNT_STATE == 'true') { ?> <label class="inputLabel" for="state"><?php echo ENTRY_STATE; ?> </label> <?php if ($process == true || $entry_state_has_zones == true) { if ($entry_state_has_zones == true) { echo zen_draw_pull_down_menu('state', $zones_array, $zone_name, 'id="state"'); } else { echo zen_draw_input_field('state', '', 'id="state"'); } } else { echo zen_draw_input_field('state', zen_get_zone_name($entry->fields['entry_country_id'], $entry->fields['entry_zone_id'], $entry->fields['entry_state']), 'id="state"'); } if (zen_not_null(ENTRY_STATE_TEXT)) { echo '<span class="alert">' . ENTRY_STATE_TEXT . '</span>'; } ?> <br class="clearBoth" /> <?php } ?> <label class="inputLabel" for="city"><?php echo ENTRY_CITY; ?> </label> <?php
if ($entry_state_has_zones == true) { $zones_array = array(); $zones_values = $db->Execute("select zone_name\r\n from " . TABLE_ZONES . "\r\n where zone_country_id = '" . zen_db_input($cInfo->entry_country_id) . "'\r\n order by zone_id"); while (!$zones_values->EOF) { $zones_array[] = array('id' => $zones_values->fields['zone_name'], 'text' => $zones_values->fields['zone_name']); $zones_values->MoveNext(); } echo zen_draw_pull_down_menu('entry_state', $zones_array) . ' ' . ENTRY_STATE_ERROR; } else { echo zen_draw_input_field('entry_state', zen_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state)) . ' ' . ENTRY_STATE_ERROR; } } else { echo $entry_state . zen_draw_hidden_field('entry_zone_id') . zen_draw_hidden_field('entry_state'); } } else { echo zen_draw_input_field('entry_state', zen_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state)); } ?> </td> </tr> <?php } ?> <tr> <td class="main"><?php echo ENTRY_CITY; ?> </td> <td class="main"> <?php
if ($entry_state_has_zones == true) { $zones_array = array(); $zones_values = $db->Execute("select zone_name\r\n from " . TABLE_ZONES . "\r\n where zone_country_id = '" . zen_db_input($cInfo->entry_country_id) . "'\r\n order by zone_id"); while (!$zones_values->EOF) { $zones_array[] = array('id' => zen_convert_to_zone_name_m17n($zones_values->fields['zone_name']), 'text' => zen_convert_to_zone_name_m17n($zones_values->fields['zone_name'])); $zones_values->MoveNext(); } echo zen_draw_pull_down_menu('entry_state', $zones_array) . ' ' . ENTRY_STATE_ERROR; } else { echo zen_draw_input_field('entry_state', zen_convert_to_zone_name_m17n(zen_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state))) . ' ' . ENTRY_STATE_ERROR; } } else { echo $entry_state . zen_draw_hidden_field('entry_zone_id') . zen_draw_hidden_field('entry_state'); } } else { echo zen_draw_input_field('entry_state', zen_convert_to_zone_name_m17n(zen_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state))); } ?> </td> </tr> <?php } ?> <tr> <td class="main"><?php echo ENTRY_CITY; ?> </td> <td class="main"> <?php
function getFormDefault($return = array()) { global $db; // ->furikana if (FURIKANA_NESESSARY) { $account_query = "\r\n SELECT customers_gender, customers_firstname, customers_lastname,\r\n customers_firstname_kana, customers_lastname_kana,\r\n customers_dob, customers_email_address,\r\n customers_email_format, customers_referral\r\n FROM " . TABLE_CUSTOMERS . "\r\n WHERE customers_id = :customersID"; } else { $account_query = "\r\n SELECT customers_gender, customers_firstname, customers_lastname,\r\n customers_dob, customers_email_address,\r\n customers_email_format, customers_referral\r\n FROM " . TABLE_CUSTOMERS . "\r\n WHERE customers_id = :customersID"; } // <-furikana $account_query = $db->bindVars($account_query, ':customersID', $_SESSION['customer_id'], 'integer'); $account = $db->Execute($account_query); $return['firstname'] = $account->fields['customers_firstname']; $return['lastname'] = $account->fields['customers_lastname']; // ->furikana if (FURIKANA_NESESSARY) { $return['firstname_kana'] = $account->fields['customers_firstname_kana']; $return['lastname_kana'] = $account->fields['customers_lastname_kana']; } // <-furikana $return['email_address'] = $account->fields['customers_email_address']; if (ACCOUNT_GENDER == 'true') { $return['gender'] = $account->fields['customers_gender']; } // if DOB field has database default setting, show blank: $return['dob'] = $account->fields['customers_dob'] == '0001-01-01 00:00:00' ? '' : date('Y/m/d', $account->fields['customers_dob']); $return['customers_referral'] = $account->fields['customers_referral']; $return['email_format'] = $account->fields['customers_email_format']; $entry_query = "\r\n SELECT entry_company, entry_street_address, entry_suburb, entry_postcode, entry_city,\r\n entry_state, entry_zone_id, entry_country_id\r\n , entry_telephone, entry_fax\r\n FROM " . TABLE_ADDRESS_BOOK . "\r\n WHERE customers_id = :customersID\r\n AND address_book_id = :addressBookID"; $entry_query = $db->bindVars($entry_query, ':customersID', $_SESSION['customer_id'], 'integer'); $entry_query = $db->bindVars($entry_query, ':addressBookID', $_SESSION['customer_default_address_id'], 'integer'); $entry = $db->Execute($entry_query); $return['company'] = $entry->fields['entry_company']; $return['street_address'] = $entry->fields['entry_street_address']; $return['suburb'] = $entry->fields['entry_suburb']; $return['postcode'] = $entry->fields['entry_postcode']; $return['city'] = $entry->fields['entry_city']; $return['state'] = $entry->fields['entry_state']; $return['zone_id'] = $entry->fields['entry_zone_id']; $return['country'] = $entry->fields['entry_country_id']; $return['telephone'] = $entry->fields['entry_telephone']; $return['fax'] = $entry->fields['entry_fax']; if (!isset($zone_name) || (int) $zone_name == 0) { $zone_name = zen_get_zone_name($entry->fields['entry_country_id'], $entry->fields['entry_zone_id'], $entry->fields['entry_state']); } if ($state == '' && $zone_name != '') { $state = $zone_name; } $return['state'] = $state; $return['zone_name'] = $zone_name; return $return; }
if (ACCOUNT_STATE == 'true') { ?> <label class="inputLabel" for="state"><?php echo ENTRY_STATE; ?> </label><br> <?php if ($process == true || $entry_state_has_zones == true) { if ($entry_state_has_zones == true) { echo zen_draw_pull_down_menu('state', $zones_array, $zone_name, 'id="state"'); } else { echo zen_draw_input_field('state', zen_get_zone_name($entry->fields['entry_country_id'], $entry->fields['entry_zone_id'], ''), zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_state', '20') . ' id="state"'); } } else { echo zen_draw_input_field('state', zen_get_zone_name($entry->fields['entry_country_id'], $entry->fields['entry_zone_id'], ''), zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_state', '20'), 'text'); } if (zen_not_null(ENTRY_STATE_TEXT)) { echo '<span class="alert">' . ENTRY_STATE_TEXT . '</span>'; } ?> <br class="clearBoth" /> <?php } ?> <label class="inputLabel" for="city"><?php echo ENTRY_CITY; ?> </label><br> <?php
<?php if ($process == true) { if ($entry_state_has_zones == true) { $zones_array = array(); $zones_query = "select zone_name from " . TABLE_ZONES . "\r\n where zone_country_id = '" . (int) $country . "'\r\n order by zone_name"; $zones_values = $db->Execute($zones_query); while (!$zones_values->EOF) { $zones_array[] = array('id' => $zones_values->fields['zone_name'], 'text' => $zones_values->fields['zone_name']); $zones_values->MoveNext(); } echo zen_draw_pull_down_menu('state', $zones_array); } else { echo zen_draw_input_field('state'); } } else { echo zen_draw_input_field('state', zen_get_zone_name($entry['entry_country_id'], $entry['entry_zone_id'], $entry['entry_state'])); } if (zen_not_null(ENTRY_STATE_TEXT)) { echo ' <span class="inputRequirement">' . ENTRY_STATE_TEXT . '</span>'; } ?> </td> </tr> <?php } ?> <tr> <td class="main"><?php echo ENTRY_POST_CODE; ?> </td>
<?php require_once '../../../kernel/setup_inc.php'; require_once BITCOMMERCE_PKG_PATH . 'includes/bitcommerce_start_inc.php'; require_once BITCOMMERCE_PKG_PATH . 'includes/functions/html_output.php'; if (empty($entry)) { $entry = $_REQUEST; } if (empty($entry['country_id'])) { $entry['country_id'] = defined('STORE_COUNTRY') ? STORE_COUNTRY : NULL; } if (!empty($entry['country_id'])) { if (!($stateInput = zen_get_country_zone_list('state', $entry['country_id'], !empty($entry['entry_zone_id']) ? $entry['entry_zone_id'] : ''))) { $stateInput = zen_draw_input_field('state', zen_get_zone_name($entry['country_id'], BitBase::getParameter($entry, 'entry_zone_id'), BitBase::getParameter($entry, 'entry_state'))); } } else { $stateInput = zen_draw_input_field('state'); } print $stateInput;