state id by state ISO CODE AND COUNTRY ISO CODE
public function getIdStateByPaypalCode($ship_addr_state, $ship_addr_country)
{
$id_state = 0;
$id_country = Country::getByIso($ship_addr_country);
if (Country::containsStates($id_country)) {
if ($id_state = (int)State::getIdByIso(Tools::strtoupper($ship_addr_state), $id_country)) {
$id_state = $id_state;
} elseif ($id_state = State::getIdByName(pSQL(trim($ship_addr_state)))) {
$state = new State((int)$id_state);
if ($state->id_country == $id_country) {
$id_state= $state->id;
}
}
}
return $id_state;
}
getIdStateByPaypalCode('NY','US')
{
$id_state = 0;
$id_country = Country::getByIso($ship_addr_country);
if (Country::containsStates($id_country)) {
if ($id_state = (int)State::getIdByIso(Tools::strtoupper($ship_addr_state), $id_country)) {
$id_state = $id_state;
} elseif ($id_state = State::getIdByName(pSQL(trim($ship_addr_state)))) {
$state = new State((int)$id_state);
if ($state->id_country == $id_country) {
$id_state= $state->id;
}
}
}
return $id_state;
}
getIdStateByPaypalCode('NY','US')
Comments
Post a Comment