function osc_cfg_set_countries_pulldown_menu($default, $key = null) { $name = !empty($key) ? 'configuration[' . $key . ']' : 'configuration_value'; $countries_array = array(); foreach (Address::getCountries() as $country) { $countries_array[] = array('id' => $country['id'], 'text' => $country['name']); } return osc_draw_pull_down_menu($name, $countries_array, $default); }
<?php /* osCommerce Online Merchant $osCommerce-SIG$ Copyright (c) 2010 osCommerce (http://www.oscommerce.com) 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\OSCOM; use osCommerce\OM\Core\Site\Shop\Address; $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'))); ?> <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; } SelectedCountry = theForm.zone_country_id.options[theForm.zone_country_id.selectedIndex].value;