You are here

function uc_quote_set_shipping_type in Ubercart 7.3

Same name and namespace in other branches
  1. 8.4 shipping/uc_quote/uc_quote.module \uc_quote_set_shipping_type()
  2. 5 shipping/uc_quote/uc_quote.module \uc_quote_set_shipping_type()
  3. 6.2 shipping/uc_quote/uc_quote.module \uc_quote_set_shipping_type()

Stores the shipping type of products and manufacturers.

Fulfillment modules are invoked for products that match their shipping type. This function stores the shipping type of a product or a manufacturer.

Parameters

$id_type: Type can be 'product' or 'manufacturer'.

$id: Either the node id or term id of the object receiving the shipping type.

$shipping_type: The type of product that is fulfilled by various fulfillment modules.

1 call to uc_quote_set_shipping_type()
uc_quote_node_update in shipping/uc_quote/uc_quote.module
Implements hook_node_update().

File

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

Code

function uc_quote_set_shipping_type($id_type, $id, $shipping_type) {
  if ($shipping_type !== '') {
    db_merge('uc_quote_shipping_types')
      ->key(array(
      'id_type' => $id_type,
      'id' => $id,
    ))
      ->fields(array(
      'shipping_type' => $shipping_type,
    ))
      ->execute();
  }
  else {
    db_delete('uc_quote_shipping_types')
      ->condition('id_type', $id_type)
      ->condition('id', $id)
      ->execute();
  }
}