public static function getRegions($id, $select = 0, $table = 'shipping')
{
if ($table == 'shipping') {
$t = '#__phocacart_shipping_method_regions';
$c = 'shipping_id';
} else {
if ($table == 'payment') {
$t = '#__phocacart_payment_method_regions';
$c = 'payment_id';
} else {
if ($table == 'zone') {
$t = '#__phocacart_zone_regions';
$c = 'zone_id';
}
}
}
$db = Factory::getDBO();
if ($select == 1) {
$query = 'SELECT r.region_id';
} else {
$query = 'SELECT a.*';
}
$query .= ' FROM #__phocacart_regions AS a' . ' LEFT JOIN ' . $t . ' AS r ON a.id = r.region_id' . ' WHERE r.' . $c . ' = ' . (int) $id;
$db->setQuery($query);
if ($select == 1) {
$items = $db->loadColumn();
} else {
$items = $db->loadObjectList();
}
return $items;
}