예제 #1
0
        $suffix = ".update?plan_id={$plan_id}";
    }
    //
    // Delete selected plans
    //
    if ($mode == 'delete') {
        if (!empty($_REQUEST['plan_ids'])) {
            fn_delete_recurring_plans($_REQUEST['plan_ids']);
        }
        $suffix = '.manage';
    }
    return array(CONTROLLER_STATUS_OK, "recurring_plans{$suffix}");
}
// ---------------------- GET routines ---------------------------------------
if ($mode == 'update') {
    $recurring_plan = fn_get_recurring_plan_data($_REQUEST['plan_id'], DESCR_SL);
    if (empty($recurring_plan)) {
        return array(CONTROLLER_STATUS_NO_PAGE);
    }
    fn_add_breadcrumb(fn_get_lang_var('rb_recurring_plans'), "recurring_plans.manage");
    Registry::set('navigation.tabs', array('general' => array('title' => fn_get_lang_var('general'), 'js' => true), 'linked_products' => array('title' => fn_get_lang_var('products'), 'js' => true)));
    $view->assign('recurring_plan', $recurring_plan);
    $view->assign('recurring_billing_data', Registry::get('recurring_billing_data'));
} elseif ($mode == 'add') {
    fn_add_breadcrumb(fn_get_lang_var('plans'), "recurring_plans.manage");
    Registry::set('navigation.tabs', array('general' => array('title' => fn_get_lang_var('general'), 'js' => true), 'linked_products' => array('title' => fn_get_lang_var('products'), 'js' => true)));
    $view->assign('recurring_billing_data', Registry::get('recurring_billing_data'));
} elseif ($mode == 'manage' || $mode == 'picker') {
    $plans = fn_get_recurring_plans($_REQUEST, DESCR_SL);
    $view->assign('recurring_plans', $plans);
} elseif ($mode == 'delete') {
예제 #2
0
function fn_recurring_billing_get_cart_product_data($product_id, &$p_data, &$product)
{
    if ((AREA != 'A' || !empty($product['extra']['recurring_force_calculate'])) && !empty($product['extra']['recurring_plan_id'])) {
        $plan_data = fn_get_recurring_plan_data($product['extra']['recurring_plan_id']);
        if (empty($plan_data['start_duration'])) {
            $price_cond = $plan_data['price'];
        } else {
            if (!empty($product['extra']['recurring_subscription_id'])) {
                $subscription = fn_get_recurring_subscription_info($product['extra']['recurring_subscription_id'], false);
                $start_price_time = fn_get_period_date($subscription['timestamp'], $plan_data['start_duration'], $plan_data['start_duration_type'] == 'D' ? 'day' : 'month');
                $price_cond = $start_price_time < TIME ? $plan_data['price'] : $plan_data['start_price'];
            } else {
                $price_cond = $plan_data['start_price'];
            }
        }
        $p_data['base_price'] = $p_data['price'] = $p_data['original_price'] = $product['display_price'] = $product['display_subtotal'] = $product['subtotal'] = fn_calculate_recurring_price($p_data['price'], $price_cond);
        $p_data['extra']['recurring_price_calculated'] = true;
        $p_data['extra']['recurring_plan_id'] = $product['extra']['recurring_plan_id'];
        $p_data['extra']['recurring_plan'] = $product['extra']['recurring_plan'];
        $p_data['extra']['recurring_duration'] = $product['extra']['recurring_duration'];
    }
}