You are here

function uc_weightquote_admin_method_edit_form in Ubercart 5

Same name and namespace in other branches
  1. 6.2 shipping/uc_weightquote/uc_weightquote.admin.inc \uc_weightquote_admin_method_edit_form()
  2. 7.3 shipping/uc_weightquote/uc_weightquote.admin.inc \uc_weightquote_admin_method_edit_form()

Configure the store default product shipping rates.

1 string reference to 'uc_weightquote_admin_method_edit_form'
uc_weightquote_menu in shipping/uc_weightquote/uc_weightquote.module
Implementation of hook_menu().

File

shipping/uc_weightquote/uc_weightquote.module, line 231
Shipping quote module that defines a shipping rate for each product based on weight.

Code

function uc_weightquote_admin_method_edit_form($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_weightquote_methods} WHERE mid = %d", $mid)))) {
    $form['mid'] = array(
      '#type' => 'value',
      '#value' => $mid,
    );
  }
  $form['title'] = array(
    '#type' => 'textfield',
    '#title' => t('Shipping method title'),
    '#description' => t('The name shown to distinguish it from other weight quote methods.'),
    '#default_value' => $method->title,
  );
  $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,
  );
  $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['unit_rate'] = array(
    '#type' => 'textfield',
    '#title' => t('Default cost adjustment per !unit', array(
      '!unit' => variable_get('uc_weight_unit', 'lb'),
    )),
    '#description' => t('The amount per weight unit to add to the shipping cost for an item.<br />Example: to add $5 per pound, put 5 in here.'),
    '#default_value' => $method->unit_rate,
    '#size' => 16,
    '#field_prefix' => $sign_flag ? '' : $currency_sign,
    '#field_suffix' => t('!sign per !unit', array(
      '!sign' => $sign_flag ? $currency_sign : '',
      '!unit' => variable_get('uc_weight_unit', 'lb'),
    )),
  );
  $form['buttons']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );
  $form['buttons']['delete'] = array(
    '#type' => 'submit',
    '#value' => t('Delete'),
  );
  return $form;
}