Back to PhocacartReward class

Method getPoints

public static
getPoints
(mixed $points, mixed $type = 'received', mixed $groupPoints = null)

Method getPoints - Source code

public static function getPoints($points, $type = 'received', $groupPoints = null)
{
    $pointsO = null;
    //$app				= JFactory::getApplication();
    $paramsC = PhocacartUtils::getComponentParameters();
    $enable_rewards = $paramsC->get('enable_rewards', 1);
    if ($enable_rewards == 0) {
        return $pointsO;
    }
    if ($type == 'needed') {
        if ($points > 0) {
            $pointsO = $points;
        }
    } else {
        if ($type == 'received') {
            if ($points > 0) {
                $pointsO = $points;
            }
            if ($groupPoints > 0) {
                $pointsO = $groupPoints;
            }
        }
    }
    return $pointsO;
}