Back to PhocacartUnit class

Method getUnits

public static
getUnits
(mixed $sectionId, mixed $limit = 0)

Method getUnits - Source code

public static function getUnits($sectionId, $limit = 0)
{
    $db = Factory::getDBO();
    $query = ' SELECT a.id, a.title FROM #__phocacart_units AS a' . ' WHERE a.published = 1' . ' AND a.section_id =' . (int) $sectionId . ' ORDER BY a.ordering';
    if ((int) $limit > 0) {
        $query .= ' LIMIT ' . (int) $limit;
    }
    $db->setQuery($query);
    $units = $db->loadObjectList();
    return $units;
}