You are here

function uc_flatrate_ca_predicate in Ubercart 6.2

Implements hook_ca_predicate().

Connect the quote action with the quote event.

File

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

Code

function uc_flatrate_ca_predicate() {
  $enabled = variable_get('uc_quote_enabled', array());
  $predicates = array();
  $result = db_query("SELECT mid, title FROM {uc_flatrate_methods}");
  while ($method = db_fetch_object($result)) {
    $predicates['uc_flatrate_get_quote_' . $method->mid] = array(
      '#title' => t('Shipping quote via @method', array(
        '@method' => $method->title,
      )),
      '#trigger' => 'get_quote_from_flatrate_' . $method->mid,
      '#class' => 'uc_flatrate',
      '#status' => $enabled['flatrate_' . $method->mid],
      '#actions' => array(
        array(
          '#name' => 'uc_quote_action_get_quote',
          '#title' => t('Fetch a flatrate shipping quote.'),
          '#argument_map' => array(
            'order' => 'order',
            'method' => 'method',
          ),
        ),
      ),
    );
  }
  return $predicates;
}