Back to PhocacartCategoryMultiple class

Method getCategoriesByIds

public static
getCategoriesByIds
(mixed $cids)

Method getCategoriesByIds - Source code

public static function getCategoriesByIds($cids)
{
    $db = Factory::getDBO();
    if ($cids != '') {
        //cids is string separated by comma
        $query = 'SELECT c.category_id FROM #__phocacart_categories AS a' . ' LEFT JOIN #__phocacart_product_categories AS c ON a.id = c.category_id' . ' WHERE c.product_id IN (' . $cids . ')' . ' ORDER BY a.id';
        $db->setQuery($query);
        $tags = $db->loadColumn();
        $tags = array_unique($tags);
        return $tags;
    }
    return array();
}