You are here

function uc_product_get_shipping_type in Ubercart 5

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

Get a product's shipping type, defaulting to its manufacturer's or the store's if it doesn't exist.

Parameters

$product: The product object.

Return value

The shipping type.

9 calls to uc_product_get_shipping_type()
uc_cart_pane_quotes in shipping/uc_quote/uc_quote.module
Cart pane callback.
uc_quote_condition_product_shipping_type in shipping/uc_quote/uc_quote.module
Returns true if the order has a product of the chosen shipping type.
uc_shipping_new_package in shipping/uc_shipping/uc_shipping.module
Put ordered products into a package.
uc_shipping_package_edit in shipping/uc_shipping/uc_shipping.module
Rearrange the products in or out of a package.
uc_ups_form_alter in shipping/uc_ups/uc_ups.module
Implementation of hook_form_alter().

... See full list

File

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

Code

function uc_product_get_shipping_type($product) {
  $shipping_type = variable_get('uc_store_shipping_type', 'small_package');
  if (module_exists('uc_manufacturer') && $product->manufacturer) {
    $m = taxonomy_get_term_by_name($product->manufacturer);
    if ($type = uc_quote_get_shipping_type('manufacturer', $m->tid)) {
      $shipping_type = $type;
    }
  }
  if ($type = uc_quote_get_shipping_type('product', $product->nid)) {
    $shipping_type = $type;
  }
  return $shipping_type;
}