You are here

function uc_flatrate_shipping_method in Ubercart 5

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

Implementation of Übercart's hook_shipping_method().

File

shipping/uc_flatrate/uc_flatrate.module, line 168
Shipping quote module that defines a flat shipping rate for each product.

Code

function uc_flatrate_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_flatrate_methods}");
  while ($method = db_fetch_object($result)) {
    $methods['flatrate_' . $method->mid] = array(
      'id' => 'flatrate_' . $method->mid,
      'module' => 'uc_flatrate',
      'title' => $method->title,
      'enabled' => $enabled['flatrate_' . $method->mid],
      'quote' => array(
        'type' => 'order',
        'callback' => 'uc_flatrate_quote',
        'accessorials' => array(
          $method->label,
        ),
      ),
      'weight' => $weight['flatrate_' . $method->mid],
    );
  }
  return $methods;
}