function osc_cfg_set_zones_pulldown_menu($default, $key = null) { $name = !empty($key) ? 'configuration[' . $key . ']' : 'configuration_value'; $zones_array = array(); foreach (Address::getZones() as $zone) { $zones_array[] = array('id' => $zone['id'], 'text' => $zone['name'], 'group' => $zone['country_name']); } return osc_draw_pull_down_menu($name, $zones_array, $default); }
} ?> <p><label for="ab_country"><?php echo OSCOM::getDef('field_country'); ?> </label><?php echo HTML::selectMenu('ab_country', $countries_array, STORE_COUNTRY); ?> </p> <?php if (ACCOUNT_STATE > -1) { if (Address::hasZones(STORE_COUNTRY)) { $zones_array = array(); foreach (Address::getZones(STORE_COUNTRY) as $zone) { $zones_array[] = array('id' => $zone['id'], 'text' => $zone['name']); } ?> <p><label for="ab_state"><?php echo OSCOM::getDef('field_state'); ?> </label><?php echo HTML::selectMenu('ab_state', $zones_array); ?> </p> <?php } else { ?>
public static function execute() { $result = array('zones' => Address::getZones($_GET['country_id']), 'rpcStatus' => RPC::STATUS_SUCCESS); echo json_encode($result); }
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License v2 (1991) as published by the Free Software Foundation. */ use osCommerce\OM\Core\ObjectInfo; use osCommerce\OM\Core\Site\Admin\Application\ZoneGroups\ZoneGroups; use osCommerce\OM\Core\OSCOM; use osCommerce\OM\Core\Site\Shop\Address; $OSCOM_ObjectInfo = new ObjectInfo(ZoneGroups::getEntry($_GET['zID'])); $countries_array = array(array('id' => '', 'text' => OSCOM::getDef('all_countries'))); foreach (Address::getCountries() as $country) { $countries_array[] = array('id' => $country['id'], 'text' => $country['name']); } $zones_array = array(array('id' => '', 'text' => OSCOM::getDef('all_zones'))); if ($OSCOM_ObjectInfo->get('zone_country_id') > 0) { foreach (Address::getZones($OSCOM_ObjectInfo->get('zone_country_id')) as $zone) { $zones_array[] = array('id' => $zone['id'], 'text' => $zone['name']); } } ?> <script type="text/javascript"> function update_zone(theForm) { var NumState = theForm.zone_id.options.length; var SelectedCountry = ""; while(NumState > 0) { NumState--; theForm.zone_id.options[NumState] = null; }