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