You are here

function uc_weightquote_admin_methods in Ubercart 6.2

Same name and namespace in other branches
  1. 5 shipping/uc_weightquote/uc_weightquote.module \uc_weightquote_admin_methods()

List and compare all weight-based shipping quote methods.

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

File

shipping/uc_weightquote/uc_weightquote.admin.inc, line 12
Weight quote shipping method administration menu items.

Code

function uc_weightquote_admin_methods() {
  $output = '';
  $context = array(
    'location' => 'shipping-weightquote-method-admin',
    'subject' => array(),
  );
  $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, product_rate FROM {uc_weightquote_methods}");
  while ($method = db_fetch_object($result)) {
    $context['subject']['weightquote_method'] = $method;
    $row = array();
    $row[] = check_plain($method->title);
    $row[] = check_plain($method->label);
    $row[] = uc_price($method->base_rate, $context);
    $row[] = uc_price($method->product_rate, $context);
    $row[] = l(t('edit'), 'admin/store/settings/quotes/methods/weightquote/' . $method->mid);
    $row[] = l(t('conditions'), CA_UI_PATH . '/uc_weightquote_get_quote_' . $method->mid . '/edit/conditions');
    $rows[] = $row;
  }
  if (count($rows)) {
    $header = array(
      t('Title'),
      t('Label'),
      t('Base rate'),
      t('Default product rate'),
      array(
        'data' => t('Operations'),
        'colspan' => 2,
      ),
    );
    $output .= theme('table', $header, $rows);
  }
  $output .= l(t('Add a new weight quote shipping method.'), 'admin/store/settings/quotes/methods/weightquote/add');
  return $output;
}