Back to PhocacartParameter class

Method getAllParameters

public static
getAllParameters
(mixed $key = 'id', mixed $ordering = 1, mixed $lang = '')

Method getAllParameters - Source code

public static function getAllParameters($key = 'id', $ordering = 1, $lang = '')
{
    $keyP = base64_encode(serialize($key) . ':' . serialize((int) $ordering . ':' . $lang));
    if (!array_key_exists((string) $keyP, self::$parameter)) {
        $db = Factory::getDBO();
        $orderingText = PhocacartOrdering::getOrderingText($ordering, 12);
        $wheres = array();
        $lefts = array();
        $columns = 'pp.id, pp.title, pp.title_header, pp.image, pp.alias, pp.description, pp.limit_count, pp.link_type';
        /*$groupsFull		= $columns;
        		$groupsFast		= 'm.id';
        		$groups			= PhocacartUtilsSettings::isFullGroupBy() ? $groupsFull : $groupsFast;*/
        $wheres[] = ' pp.published = 1';
        if ($lang != '' && $lang != '*') {
            $wheres[] = PhocacartUtilsSettings::getLangQuery('pp.language', $lang);
        }
        $q = ' SELECT DISTINCT ' . $columns . ' FROM  #__phocacart_parameters AS pp' . (!empty($lefts) ? ' LEFT JOIN ' . implode(' LEFT JOIN ', $lefts) : '') . (!empty($wheres) ? ' WHERE ' . implode(' AND ', $wheres) : '') . ' ORDER BY ' . $orderingText;
        $db->setQuery($q);
        try {
            $items = $db->loadObjectList($key);
        } catch (Exception $e) {
            Factory::getApplication()->enqueueMessage(Text::sprintf('JLIB_DATABASE_ERROR_FUNCTION_FAILED', $e->getCode(), $e->getMessage()), 'error');
            return;
        }
        /*
        			try {
        				$items = $db->loadObjectList();
        			} catch (RuntimeException $e) {
        				throw new Exception($e->getMessage(), 500, $e);
        				return false;
        			}*/
        self::$parameter[$keyP] = $items;
    }
    return self::$parameter[$keyP];
}