Back to PhocacartUtils class

Method setOptionParameter

public static
setOptionParameter
(mixed $parameter, mixed $value = '')

Method setOptionParameter - Source code

public static function setOptionParameter($parameter, $value = '')
{
    $component = 'com_phocacart';
    $paramsC = ComponentHelper::getParams($component);
    $paramsC->set($parameter, $value);
    $data['params'] = $paramsC->toArray();
    $table = Table::getInstance('extension');
    $idCom = $table->find(array('element' => $component));
    $table->load($idCom);
    if (!$table->bind($data)) {
        throw new Exception($table->getError());
        return false;
    }
    // pre-save checks
    if (!$table->check()) {
        throw new Exception($table->getError());
        return false;
    }
    // save the changes
    if (!$table->store()) {
        throw new Exception($table->getError());
        return false;
    }
    return true;
}