You are here

function uc_quote_set_shipping_type in Ubercart 8.4

Same name and namespace in other branches
  1. 5 shipping/uc_quote/uc_quote.module \uc_quote_set_shipping_type()
  2. 6.2 shipping/uc_quote/uc_quote.module \uc_quote_set_shipping_type()
  3. 7.3 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

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

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

string $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 294
The controller module for fulfillment modules that process physical goods.

Code

function uc_quote_set_shipping_type($id_type, $id, $shipping_type) {
  $connection = \Drupal::database();
  if ($shipping_type !== '') {
    $connection
      ->merge('uc_quote_shipping_types')
      ->key([
      'id_type' => $id_type,
      'id' => $id,
    ])
      ->fields([
      'shipping_type' => $shipping_type,
    ])
      ->execute();
  }
  else {
    $connection
      ->delete('uc_quote_shipping_types')
      ->condition('id_type', $id_type)
      ->condition('id', $id)
      ->execute();
  }
}