public static function getDiscountCatsById($discounId, $select = 0)
{
$db = Factory::getDBO();
if ($select == 1) {
$query = 'SELECT di.discount_id';
} else {
$query = 'SELECT c.id as value, c.title as text';
}
$query .= ' FROM #__phocacart_categories AS c' . ' LEFT JOIN #__phocacart_discount_categories AS di ON c.id = di.category_id' . ' WHERE di.discount_id = ' . (int) $discounId;
$db->setQuery($query);
if ($select == 1) {
$coupon = $db->loadColumn();
} else {
$coupon = $db->loadObjectList();
}
return $coupon;
}