You are here

function uc_weightquote_shipping_method in Ubercart 5

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

Implementation of Übercart's hook_shipping_method().

File

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

Code

function uc_weightquote_shipping_method() {
  $methods = array();
  $enabled = variable_get('uc_quote_enabled', array());
  $weight = variable_get('uc_quote_method_weight', array());
  $result = db_query("SELECT mid, title, label FROM {uc_weightquote_methods}");
  while ($method = db_fetch_object($result)) {
    $methods['weightquote_' . $method->mid] = array(
      'id' => 'weightquote_' . $method->mid,
      'module' => 'uc_weightquote',
      'title' => $method->title,
      'enabled' => $enabled['weightquote_' . $method->mid],
      'quote' => array(
        'type' => 'order',
        'callback' => 'uc_weightquote_quote',
        'accessorials' => array(
          $method->label,
        ),
      ),
      'weight' => $weight['weightquote_' . $method->mid],
    );
  }
  return $methods;
}