Back to PhocacartCategory class

Method getActiveCategories

public static
getActiveCategories
(mixed $items, mixed $ordering)

Method getActiveCategories - Source code

public static function getActiveCategories($items, $ordering)
{
    $db = Factory::getDbo();
    $o = array();
    $wheres = array();
    $ordering = PhocacartOrdering::getOrderingText($ordering, 1);
    //c
    if ($items != '') {
        $wheres[] = 'c.id IN (' . $items . ')';
        $q = 'SELECT DISTINCT c.title, CONCAT(c.id, \'-\', c.alias) AS alias, \'c\' AS parameteralias, \'category\' AS parametertitle FROM #__phocacart_categories AS c' . (!empty($wheres) ? ' WHERE ' . implode(' AND ', $wheres) : '') . ' GROUP BY c.alias, c.title' . ' ORDER BY ' . $ordering;
        $db->setQuery($q);
        $o = $db->loadAssocList();
    }
    return $o;
}