Back to PhocacartCountry class

Method getCountryById

public static
getCountryById
(mixed $countryId)

Method getCountryById - Source code

public static function getCountryById($countryId)
{
    $db = Factory::getDBO();
    $query = 'SELECT title FROM #__phocacart_countries WHERE id = ' . (int) $countryId . ' ORDER BY title LIMIT 1';
    $db->setQuery($query);
    $country = $db->loadColumn();
    if (isset($country[0])) {
        return (string) $country[0];
    }
    return '';
}