You are here

function uc_weightquote_admin_methods in Ubercart 5

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

List and compare all weight quote shipping quote methods.

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

File

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

Code

function uc_weightquote_admin_methods() {
  $output = '';
  $rows = array();
  $enabled = variable_get('uc_quote_enabled', array());
  $weight = variable_get('uc_quote_method_weight', array());
  $result = db_query("SELECT mid, title, label, base_rate, unit_rate FROM {uc_weightquote_methods}");
  while ($method = db_fetch_object($result)) {
    $row = array();
    $row[] = check_plain($method->title);
    $row[] = check_plain($method->label);
    $row[] = uc_currency_format($method->base_rate);
    $row[] = uc_currency_format($method->unit_rate);
    $row[] = l(t('edit'), 'admin/store/settings/quotes/methods/weightquote/' . $method->mid . '/edit');
    $rows[] = $row;
  }
  if (count($rows)) {
    $header = array(
      t('Title'),
      t('Label'),
      t('Base rate'),
      t('Rate per !unit', array(
        '!unit' => variable_get('uc_weight_unit', 'lb'),
      )),
      t('Actions'),
    );
    $output .= theme('table', $header, $rows);
  }
  $output .= l(t('Add a new weight quote shipping method.'), 'admin/store/settings/quotes/methods/weightquote/add');
  return $output;
}