public static function getUserCountryId()
{
$user = PhocacartUser::getUser();
$app = Factory::getApplication();
$paramsC = PhocacartUtils::getComponentParameters();
$dynamic_tax_rate = $paramsC->get('dynamic_tax_rate', 0);
$type = 0;
if ($dynamic_tax_rate == 1) {
$type = 0;
} else {
if ($dynamic_tax_rate == 2) {
$type = 1;
}
}
if (isset($user->id) && (int) $user->id > 0 && (int) $dynamic_tax_rate > 0) {
$db = Factory::getDBO();
$q = 'SELECT country' . ' FROM #__phocacart_users' . ' WHERE user_id = ' . (int) $user->id . ' AND type = ' . (int) $type . ' LIMIT 1';
$db->setQuery($q);
$countryId = $db->loadResult();
if ((int) $countryId > 0) {
return $countryId;
}
}
return 0;
}