Back to PhocacartTag class

Method getTagLabels

public static mixed|void|array
getTagLabels
(mixed $itemId, mixed $select = 0)
Labels - are displayed at the top
Parameters
  • int $itemId
  • \number $select
Returns
  • mixed|void|array

Method getTagLabels - Source code

/**
 * Labels - are displayed at the top
 * @param int $itemId
 * @param number $select
 * @return mixed|void|mixed[]
 */
public static function getTagLabels($itemId, $select = 0)
{
    $db = Factory::getDBO();
    if ($select == 1) {
        $query = 'SELECT r.tag_id';
    } else {
        if ($select == 2) {
            $query = 'SELECT a.id, a.alias ';
        } else {
            $query = 'SELECT a.id, a.title, a.alias, a.type, a.display_format, a.link_ext, a.link_cat, a.icon_class';
        }
    }
    $query .= ' FROM #__phocacart_tags AS a' . ' LEFT JOIN #__phocacart_taglabels_related AS r ON a.id = r.tag_id' . ' WHERE a.type = 1' . ' AND r.item_id = ' . (int) $itemId . ' ORDER BY a.id';
    $db->setQuery($query);
    if ($select == 1) {
        $tags = $db->loadColumn();
    } else {
        $tags = $db->loadObjectList();
    }
    return $tags;
}