Back to PhocacartTag class

Method getTags

public static mixed|void|array
getTags
(mixed $itemId, mixed $select = 0)
Standard Tags - are displayed at the bottom
Parameters
  • int $itemId
  • \number $select
Returns
  • mixed|void|array

Method getTags - Source code

/**
 * Standard Tags - are displayed at the bottom
 * @param int $itemId
 * @param number $select
 * @return mixed|void|mixed[]
 */
public static function getTags($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_tags_related AS r ON a.id = r.tag_id' . ' WHERE a.type = 0' . ' 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;
}