<?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); }
$countryInfo = zen_get_countries($_SESSION['cart_country_id'], true); $order->delivery = array('country' => array('countries_id' => $countryInfo['countries_id'], 'title' => $countryInfo['countries_name'], 'countries_iso_code_2' => $countryInfo['countries_iso_code_2'], 'countries_iso_code_3' => $countryInfo['countries_iso_code_3']), 'country_id' => $countryInfo['countries_id'], 'format_id' => $countryInfo['address_format_id']); // Check for form zip code if (!empty($_REQUEST['zip_code'])) { $_SESSION['cart_zip_code'] = $_REQUEST['zip_code']; } $order->delivery['postcode'] = !empty($_SESSION['cart_zip_code']) ? $_SESSION['cart_zip_code'] : NULL; // Check for form state if (isset($_REQUEST['zone_id'])) { $_SESSION['cart_zone_id'] = $_REQUEST['zone_id']; } if (!empty($_SESSION['cart_zone_id'])) { $order->delivery['zone_id'] = (int) $_SESSION['cart_zone_id']; } // used as a check below for existence of states $stateMenu = zen_get_country_zone_list('zone_id', $order->delivery['country']['countries_id'], !empty($_SESSION['cart_zone_id']) ? $_SESSION['cart_zone_id'] : NULL); $gBitSmarty->assign_by_ref('stateMenu', $stateMenu); } elseif (!empty($addresses) && (empty($_REQUEST['address_id']) || $_REQUEST['address_id'] != 'custom')) { if (!empty($_REQUEST['address_id'])) { $_SESSION['cart_address_id'] = $_REQUEST['address_id']; } elseif (empty($_SESSION['cart_address_id']) && !empty($addresses)) { // no selected address yet, snag the first one reset($addresses); $first = current($addresses); $_SESSION['cart_address_id'] = $gBitCustomer->getField('customers_default_address_id', $first['address_book_id']); } if (isset($_SESSION['cart_address_id']) && ($selAddress = $gBitCustomer->getAddress($_SESSION['cart_address_id']))) { $order->delivery = array('postcode' => $selAddress['entry_postcode'], 'country' => array('countries_id' => $selAddress['entry_country_id'], 'title' => $selAddress['countries_name'], 'countries_iso_code_2' => $selAddress['countries_iso_code_2'], 'countries_iso_code_3' => $selAddress['countries_iso_code_3']), 'country_id' => $selAddress['entry_country_id'], 'format_id' => $selAddress['address_format_id']); if (!empty($_SESSION['cart_zone_id'])) { $order->delivery['zone_id'] = (int) $selAddress['entry_zone_id']; }
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; }
<?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;