if (!$error) {
        $this->RedirectToTab($id);
    }
}
// build the form
if (!empty($error)) {
    echo $this->ShowErrors($error);
}
$smarty->assign('grouplist', $groups);
$smarty->assign('pkgdata', $rec);
$smarty->assign('formstart', $this->CGCreateFormStart($id, 'admin_addpaidpkg', $returnid, $params));
$smarty->assign('formend', $this->CreateFormEnd());
$smarty->assign('input_description', $this->CreateTextArea(true, $id, $rec['description'], 'pkg_description'));
$subscr_type = array();
$subscr_type['none'] = $this->Lang('none');
$subscr_type['month'] = $this->Lang('month');
$subscr_type['year'] = $this->Lang('year');
$smarty->assign('subscr_types', $subscr_type);
$tmp = array();
for ($i = 1; $i < 25; $i++) {
    $tmp[$i] = $i;
}
$smarty->assign('nums', $tmp);
if ($this->GetModuleInstance('CGEcommerceBase')) {
    $smarty->assign('currency_symbol', cg_ecomm::get_currency_symbol());
    $smarty->assign('currency_code', cg_ecomm::get_currency_code());
}
echo $this->ProcessTemplate('admin_addpaidpkg.tpl');
#
# EOF
#
Exemplo n.º 2
0
$action = 'post_registeruser';
$parms = array();
$parms['username'] = $username;
$parms['email'] = $email;
$expires = '';
$docreatefeu = 1;
if ($this->GetPreference('allowpaidregistration')) {
    // we're doing paid registration.
    // first, get the package info.
    $pkgid = $params['pkg'];
    $query = 'SELECT * FROM ' . cms_db_prefix() . 'module_selfreg_paidpkgs WHERE gid = ? AND id = ?';
    $pkg = $db->GetRow($query, array($params['group_id'], $pkgid));
    $expires = selfreg_utils::pkg_subscr_to_expirydate($pkg);
    if ($pkg && $pkg['cost'] > 0) {
        // this package costs money.
        $cart = cg_ecomm::get_cart_module();
        if ($cart) {
            $redirect_pref = 'redirect_paidpkg';
            // now we gotta add an item to the cart.
            $item = new cg_ecomm_cartitem('', $tmpuid, 1, $this->GetName());
            $item->set_type(cg_ecomm_cartitem::TYPE_SERVICE);
            $item->set_base_price($pkg['cost']);
            $smarty->assign('tmpuid', $tmpuid);
            $smarty->assign('username', $username);
            $smarty->assign('pkg', $pkg);
            $sku = 'sr-' . sprintf('%03d-%05d', $pkg['id'], $tmpuid);
            $smarty->assign('sku', $sku);
            $tmp = '{sitename} membership {$tmpuid}';
            $tpl = $this->GetPreference('cartitem_summary_tpl');
            if (!$tpl) {
                $tpl = $tmp;