function getCountries() { global $toC_Json; foreach (osC_Address::getCountries() as $country) { $countries_array[] = array('id' => $country['id'], 'text' => $country['name']); } $response = array(EXT_JSON_READER_ROOT => $countries_array); echo $toC_Json->encode($response); }
function osc_cfg_set_countries_pulldown_menu($default, $key = null) { $name = !empty($key) ? 'configuration[' . $key . ']' : 'configuration_value'; $countries_array = array(); foreach (osC_Address::getCountries() as $country) { $countries_array[] = array('id' => $country['id'], 'text' => $country['name']); } return osc_draw_pull_down_menu($name, $countries_array, $default); }
<div class="controls"> <?php echo osc_draw_input_field('city', isset($Qentry) ? $Qentry->value('entry_city') : null); ?> </div> </div> <div class="control-group"> <label class="control-label" for="country"><?php echo $osC_Language->get('field_customer_country'); ?> <em>*</em></label> <div class="controls"> <?php $countries_array = array(array('id' => '', 'text' => $osC_Language->get('pull_down_default'))); foreach (osC_Address::getCountries() as $country) { $countries_array[] = array('id' => $country['id'], 'text' => $country['name']); } echo osc_draw_pull_down_menu('country', $countries_array, isset($Qentry) ? $Qentry->valueInt('entry_country_id') : STORE_COUNTRY); ?> </div> </div> <?php if (ACCOUNT_STATE > -1) { ?> <div class="control-group"> <label class="control-label" for="state"><?php echo $osC_Language->get('field_customer_state') . (ACCOUNT_STATE > 0 ? '<em>*</em>' : ''); ?> </label>
function getCountries() { global $toC_Json; $records = array(); foreach (osC_Address::getCountries() as $country) { $records[] = array('country_id' => $country['id'], 'country_title' => $country['name']); } echo $toC_Json->encode(array(EXT_JSON_READER_ROOT => $records)); }