|
@@ 210-223 (lines=14) @@
|
| 207 |
|
//// |
| 208 |
|
// Returns the zone (State/Province) name |
| 209 |
|
// TABLES: zones |
| 210 |
|
function tep_get_zone_name($country_id, $zone_id, $default_zone) { |
| 211 |
|
$OSCOM_Db = Registry::get('Db'); |
| 212 |
|
|
| 213 |
|
$Qzone = $OSCOM_Db->prepare('select zone_name from :table_zones where zone_country_id = :zone_country_id and zone_id = :zone_id'); |
| 214 |
|
$Qzone->bindInt(':zone_country_id', $country_id); |
| 215 |
|
$Qzone->bindInt(':zone_id', $zone_id); |
| 216 |
|
$Qzone->execute(); |
| 217 |
|
|
| 218 |
|
if ($Qzone->fetch() !== false) { |
| 219 |
|
return $Qzone->value('zone_name'); |
| 220 |
|
} else { |
| 221 |
|
return $default_zone; |
| 222 |
|
} |
| 223 |
|
} |
| 224 |
|
|
| 225 |
|
//// |
| 226 |
|
// Returns the zone (State/Province) code |
|
@@ 228-241 (lines=14) @@
|
| 225 |
|
//// |
| 226 |
|
// Returns the zone (State/Province) code |
| 227 |
|
// TABLES: zones |
| 228 |
|
function tep_get_zone_code($country_id, $zone_id, $default_zone) { |
| 229 |
|
$OSCOM_Db = Registry::get('Db'); |
| 230 |
|
|
| 231 |
|
$Qzone = $OSCOM_Db->prepare('select zone_code from :table_zones where zone_country_id = :zone_country_id and zone_id = :zone_id'); |
| 232 |
|
$Qzone->bindInt(':zone_country_id', $country_id); |
| 233 |
|
$Qzone->bindInt(':zone_id', $zone_id); |
| 234 |
|
$Qzone->execute(); |
| 235 |
|
|
| 236 |
|
if ($Qzone->fetch() !== false) { |
| 237 |
|
return $Qzone->value('zone_code'); |
| 238 |
|
} else { |
| 239 |
|
return $default_zone; |
| 240 |
|
} |
| 241 |
|
} |
| 242 |
|
|
| 243 |
|
//// |
| 244 |
|
// Wrapper function for round() |
|
@@ 405-419 (lines=15) @@
|
| 402 |
|
//// |
| 403 |
|
// Returns the address_format_id for the given country |
| 404 |
|
// TABLES: countries; |
| 405 |
|
function tep_get_address_format_id($country_id) { |
| 406 |
|
$OSCOM_Db = Registry::get('Db'); |
| 407 |
|
|
| 408 |
|
$format_id = 1; |
| 409 |
|
|
| 410 |
|
$Qformat = $OSCOM_Db->prepare('select address_format_id from :table_countries where countries_id = :countries_id'); |
| 411 |
|
$Qformat->bindInt(':countries_id', $country_id); |
| 412 |
|
$Qformat->execute(); |
| 413 |
|
|
| 414 |
|
if ($Qformat->fetch() !== false) { |
| 415 |
|
$format_id = $Qformat->valueInt('address_format_id'); |
| 416 |
|
} |
| 417 |
|
|
| 418 |
|
return $format_id; |
| 419 |
|
} |
| 420 |
|
|
| 421 |
|
//// |
| 422 |
|
// Return a formatted address |