Back to PhocacartUtilsOptions class

Method getOptions

public static
getOptions
(mixed $component, mixed $client, mixed $option)

Method getOptions - Source code

/*
 * Load Phoca Cart Options only once per site
 * Options can be different when they are called in administration or in site, or on com_phocacart site or not com_phocacart site
 * Component = PC (Phoca Cart)
 * Client = A (Administrator) | S (Site)
 * Option = com_phocacart
 *
 * Possible values:
 * PCAcom_phocacart - Phoca Cart component, Administrator, option=com_phocacart
 * PCScom_phocacart - Phoca Cart component, Site, option=com_phocacart
 * PCScom_content - Phoca Cart component, Site, option=com_content (we need options for Phoca Cart module displayed on com_content page)
 * (there can be some exceptions like if we call router where the option is not known yet)
 *
 * PhocaCartUtils::getComponentParameters -> PhocaCartUtilsOptions::getOptions (singleton)
 *
 */
public static function getOptions($component, $client, $option)
{
    $elementOption = $component . $client . $option;
    if (is_null($elementOption)) {
        throw new Exception('Function Error: No element added', 500);
        return false;
    }
    if (!array_key_exists($elementOption, self::$options)) {
        $app = Factory::getApplication();
        if ($client == 'A') {
            self::$options[$elementOption] = ComponentHelper::getParams('com_phocacart');
        } else {
            if ($option == 'com_phocacart') {
                self::$options[$elementOption] = $app->getParams();
            } else {
                self::$options[$elementOption] = ComponentHelper::getParams('com_phocacart');
            }
        }
    }
    return self::$options[$elementOption];
}