You are here

function uc_quote_uc_order in Ubercart 7.3

Implements hook_uc_order().

1 call to uc_quote_uc_order()
uc_quote_apply_quote_to_order in shipping/uc_quote/uc_quote.module
Ajax callback: Manually applies a shipping quote to an order.

File

shipping/uc_quote/uc_quote.module, line 293
The controller module for fulfillment modules that process physical goods.

Code

function uc_quote_uc_order($op, $order, $arg2) {
  switch ($op) {
    case 'save':
      if (isset($order->quote['method'])) {
        db_merge('uc_order_quotes')
          ->key(array(
          'order_id' => $order->order_id,
        ))
          ->fields(array(
          'method' => $order->quote['method'],
          'accessorials' => $order->quote['accessorials'],
          'rate' => $order->quote['rate'],
        ))
          ->execute();
      }
      break;
    case 'load':
      $quote = db_query("SELECT method, accessorials, rate FROM {uc_order_quotes} WHERE order_id = :id", array(
        ':id' => $order->order_id,
      ))
        ->fetchAssoc();
      $order->quote = $quote;
      $order->quote['accessorials'] = strval($quote['accessorials']);
      break;
    case 'delete':
      db_delete('uc_order_quotes')
        ->condition('order_id', $order->order_id)
        ->execute();
      break;
  }
}