You are here

function uc_flatrate_uc_shipping_method in Ubercart 7.3

Implements hook_uc_shipping_method().

File

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

Code

function uc_flatrate_uc_shipping_method() {
  $methods = array();
  $result = db_query("SELECT mid, title, label, base_rate, product_rate FROM {uc_flatrate_methods}");
  foreach ($result as $method) {
    $methods['flatrate_' . $method->mid] = array(
      'id' => 'flatrate_' . $method->mid,
      'module' => 'uc_flatrate',
      'title' => $method->title,
      'description' => t('!base_rate + !product_rate per item', array(
        '!base_rate' => uc_currency_format($method->base_rate),
        '!product_rate' => uc_currency_format($method->product_rate),
      )),
      'operations' => array(
        'edit' => array(
          'title' => t('edit'),
          'href' => 'admin/store/settings/quotes/methods/flatrate/' . $method->mid,
        ),
        'delete' => array(
          'title' => t('delete'),
          'href' => 'admin/store/settings/quotes/flatrate/' . $method->mid . '/delete',
        ),
      ),
      'quote' => array(
        'type' => 'order',
        'callback' => 'uc_flatrate_quote',
        'accessorials' => array(
          $method->label,
        ),
      ),
      'enabled' => TRUE,
    );
  }
  return $methods;
}