Esempio n. 1
0
if ($settings_response['payload']) {
    $current_currency = $settings_response['payload'];
} else {
    $current_currency = 'USD';
}
$cash_admin->page_data['currency_options'] = AdminHelper::echoCurrencyOptions($current_currency);
// current paypal
$settings_response = $cash_admin->requestAndStore(array('cash_request_type' => 'system', 'cash_action' => 'getsettings', 'type' => 'payment_defaults', 'user_id' => $cash_admin->effective_user_id));
if (is_array($settings_response['payload'])) {
    $pp_default = $settings_response['payload']['pp_default'];
    $pp_micro = $settings_response['payload']['pp_micro'];
} else {
    $pp_default = 0;
    $pp_micro = 0;
}
$cash_admin->page_data['currency_options'] = AdminHelper::echoCurrencyOptions($current_currency);
$pp = array();
foreach ($page_data_object->getConnectionsByType('com.paypal') as $ppq) {
    $pp[$ppq['id']] = $ppq['name'];
}
$cash_admin->page_data['paypal_default_options'] = AdminHelper::echoFormOptions($pp, $pp_default, false, true);
$cash_admin->page_data['paypal_micro_options'] = AdminHelper::echoFormOptions($pp, $pp_micro, false, true);
// handle regions
if (isset($_POST['region1'])) {
    $regions = array('region1' => $_POST['region1'], 'region2' => $_POST['region2']);
    $settings_response = $cash_admin->requestAndStore(array('cash_request_type' => 'system', 'cash_action' => 'setsettings', 'type' => 'regions', 'value' => $regions, 'user_id' => $cash_admin->effective_user_id));
    if ($settings_response['payload']) {
        AdminHelper::formSuccess('Success.', '/commerce/');
    }
}
// now get the current setting