function uc_flatrate_admin_method_edit_form in Ubercart 6.2
Same name and namespace in other branches
- 5 shipping/uc_flatrate/uc_flatrate.module \uc_flatrate_admin_method_edit_form()
- 7.3 shipping/uc_flatrate/uc_flatrate.admin.inc \uc_flatrate_admin_method_edit_form()
Configure the store default product shipping rates.
See also
uc_flatrate_admin_method_edit_form_validate()
uc_flatrate_admin_method_edit_form_delete()
uc_flatrate_admin_method_edit_form_submit()
1 string reference to 'uc_flatrate_admin_method_edit_form'
- uc_flatrate_menu in shipping/
uc_flatrate/ uc_flatrate.module - Implements hook_menu().
File
- shipping/
uc_flatrate/ uc_flatrate.admin.inc, line 49 - Flat rate shipping method administration menu items.
Code
function uc_flatrate_admin_method_edit_form($form_state, $mid = 0) {
$form = array();
$sign_flag = variable_get('uc_sign_after_amount', FALSE);
$currency_sign = variable_get('uc_currency_sign', '$');
if (is_numeric($mid) && ($method = db_fetch_object(db_query("SELECT * FROM {uc_flatrate_methods} WHERE mid = %d", $mid)))) {
$form['mid'] = array(
'#type' => 'value',
'#value' => $mid,
);
}
else {
$method = (object) array(
'title' => '',
'label' => '',
'base_rate' => '',
'product_rate' => '',
);
}
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Shipping method title'),
'#description' => t('The name shown to distinguish it from other flatrate methods.'),
'#default_value' => $method->title,
'#required' => TRUE,
);
$form['label'] = array(
'#type' => 'textfield',
'#title' => t('Line item label'),
'#description' => t('The name shown to the customer when they choose a shipping method at checkout.'),
'#default_value' => $method->label,
'#required' => TRUE,
);
$form['base_rate'] = array(
'#type' => 'textfield',
'#title' => t('Base price'),
'#description' => t('The starting price for shipping costs.'),
'#default_value' => $method->base_rate,
'#size' => 16,
'#field_prefix' => $sign_flag ? '' : $currency_sign,
'#field_suffix' => $sign_flag ? $currency_sign : '',
);
$form['product_rate'] = array(
'#type' => 'textfield',
'#title' => t('Default product shipping rate'),
'#description' => t('Additional shipping cost per product in cart.'),
'#default_value' => $method->product_rate,
'#size' => 16,
'#field_prefix' => $sign_flag ? '' : $currency_sign,
'#field_suffix' => $sign_flag ? $currency_sign : '',
);
$form['buttons']['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
);
$form['buttons']['delete'] = array(
'#type' => 'submit',
'#value' => t('Delete'),
'#submit' => array(
'uc_flatrate_admin_method_edit_form_delete',
),
);
return $form;
}